|
@@ -49297,7 +49297,7 @@
|
|
|
};
|
|
|
var planeGeo$2 = new PlaneBufferGeometry(1, 1);
|
|
|
var voidGeometry = new BufferGeometry();
|
|
|
- var markerMats;
|
|
|
+ var markerMats, dragPointMat;
|
|
|
var getMarkerMat = function getMarkerMat(name) {
|
|
|
if (!markerMats) {
|
|
|
markerMats = {
|
|
@@ -49395,6 +49395,7 @@
|
|
|
this.selectStates = {};
|
|
|
this.setFadeFar(null);
|
|
|
this.geoPoints = [];
|
|
|
+ this.lineHeight = prop.lineHeight == void 0 ? titleLineHeight : prop.lineHeight;
|
|
|
{
|
|
|
var group = new Object3D();
|
|
|
group.name = 'titleGroup';
|
|
@@ -49430,54 +49431,107 @@
|
|
|
textAlign: Potree.settings.isOfficial && 'left'
|
|
|
}));
|
|
|
this.titleLabel.sprite.material.depthTest = false;
|
|
|
- var line = LineDraw.createFatLine([new Vector3(0, 0, 0), new Vector3(0, 0, titleLineHeight)], Object.assign({}, depthProps, {
|
|
|
+ var line = LineDraw.createFatLine([new Vector3(0, 0, 0), new Vector3(0, 0, this.lineHeight)], Object.assign({}, depthProps, {
|
|
|
color: '#ffffff',
|
|
|
lineWidth: 1,
|
|
|
transparent: true,
|
|
|
fadeFar: this.fadeFar
|
|
|
}));
|
|
|
line.renderOrder = Potree.config.renderOrders.line;
|
|
|
+ line.name = 'line';
|
|
|
+ this.titleLine = line;
|
|
|
group.add(line);
|
|
|
group.add(this.titleLabel);
|
|
|
- this.titleLabel.position.z = titleLineHeight;
|
|
|
+ this.titleLabel.position.z = this.lineHeight;
|
|
|
this.add(group);
|
|
|
this.setTitleVisi(this.titleLabel.parent, false, 'noPoint');
|
|
|
this.setTitle(Potree.settings.isOfficial ? '' : 'title');
|
|
|
- line.addEventListener('mouseover', e => {
|
|
|
- this.editEnable && CursorDeal.add('hoverGrab');
|
|
|
- });
|
|
|
- line.addEventListener('startDragging', e => {
|
|
|
+ if (!dragPointMat) {
|
|
|
+ var map = texLoader$7.load(Potree.resourcePath + '/textures/whiteCircle.png', () => {});
|
|
|
+ dragPointMat = {
|
|
|
+ default: new MeshBasicMaterial({
|
|
|
+ map,
|
|
|
+ transparent: true,
|
|
|
+ color: '#0fe',
|
|
|
+ opacity: 0,
|
|
|
+ depthTest: false
|
|
|
+ }),
|
|
|
+ hover: new MeshBasicMaterial({
|
|
|
+ map,
|
|
|
+ transparent: true,
|
|
|
+ color: '#0fe',
|
|
|
+ opacity: 0.4,
|
|
|
+ depthTest: false
|
|
|
+ })
|
|
|
+ };
|
|
|
+ }
|
|
|
+ this.lineDragPoint = new Mesh(planeGeo$2, dragPointMat.default); //修改线高度时出现的小圆点
|
|
|
+ this.lineDragPoint.scale.set(0.15, 0.15, 0.15);
|
|
|
+ this.lineDragPoint.name = 'lineDragPoint';
|
|
|
+ this.lineDragPoint.renderOrder = this.lineDragPoint.pickOrder = 10;
|
|
|
+ this.titleLabel.add(this.lineDragPoint);
|
|
|
+ var hoverState = {},
|
|
|
+ grabbingObject;
|
|
|
+ var setDragPointState = state => {
|
|
|
+ this.lineDragPoint.material = state ? dragPointMat.hover : dragPointMat.default;
|
|
|
+ this.titleLabel.sprite.material.opacity = state ? 0.5 : 1;
|
|
|
+ };
|
|
|
+ var autoPointState = () => {
|
|
|
+ setDragPointState(hoverState.lineDragPoint || grabbingObject == 'lineDragPoint');
|
|
|
+ };
|
|
|
+ var autoCursor = () => {
|
|
|
+ if (this.editEnable && Object.values(hoverState).some(e => e)) {
|
|
|
+ CursorDeal.add('hoverGrab');
|
|
|
+ } else {
|
|
|
+ CursorDeal.remove('hoverGrab');
|
|
|
+ }
|
|
|
+ autoPointState();
|
|
|
+ };
|
|
|
+ [line, this.lineDragPoint].forEach(e => e.addEventListener('mouseover', e => {
|
|
|
+ hoverState[e.target.name] = 1;
|
|
|
+ autoCursor();
|
|
|
+ }));
|
|
|
+ [line, this.lineDragPoint].forEach(e => e.addEventListener('mouseleave', e => {
|
|
|
+ hoverState[e.target.name] = 0;
|
|
|
+ autoCursor();
|
|
|
+ }));
|
|
|
+ [line, this.lineDragPoint].forEach(e => e.addEventListener('startDragging', e => {
|
|
|
this.editEnable && CursorDeal.add('grabbing');
|
|
|
- });
|
|
|
- line.addEventListener('drop', e => {
|
|
|
+ grabbingObject = e.target.name;
|
|
|
+ autoPointState();
|
|
|
+ }));
|
|
|
+ [line, this.lineDragPoint].forEach(e => e.addEventListener('drop', e => {
|
|
|
this.editEnable && CursorDeal.remove('grabbing');
|
|
|
- });
|
|
|
- line.addEventListener('mouseleave', e => {
|
|
|
- this.editEnable && CursorDeal.remove('hoverGrab');
|
|
|
- });
|
|
|
- line.addEventListener('drag', e => {
|
|
|
+ grabbingObject = null;
|
|
|
+ autoPointState();
|
|
|
+ }));
|
|
|
+ [line, this.lineDragPoint].forEach(e => e.addEventListener('drag', e => {
|
|
|
if (this.editEnable) {
|
|
|
- var _e$intersect, _e$intersect3, _e$intersect4;
|
|
|
//一旦用户拖动了title,title就固定了,不再随着path居中
|
|
|
- var position;
|
|
|
- if ((_e$intersect = e.intersect) !== null && _e$intersect !== void 0 && _e$intersect.location) {
|
|
|
- var _e$intersect2;
|
|
|
- position = (_e$intersect2 = e.intersect) === null || _e$intersect2 === void 0 ? void 0 : _e$intersect2.location;
|
|
|
- } else {
|
|
|
- var {
|
|
|
- x,
|
|
|
- y
|
|
|
- } = Potree.Utils.getPointerPosAtHeight(0, e.pointer);
|
|
|
- position = new Vector3(x, y, 0);
|
|
|
+ if (e.target.name == 'line') {
|
|
|
+ var _e$intersect, _e$intersect3, _e$intersect4;
|
|
|
+ var position;
|
|
|
+ if ((_e$intersect = e.intersect) !== null && _e$intersect !== void 0 && _e$intersect.location) {
|
|
|
+ var _e$intersect2;
|
|
|
+ position = (_e$intersect2 = e.intersect) === null || _e$intersect2 === void 0 ? void 0 : _e$intersect2.location;
|
|
|
+ } else {
|
|
|
+ var {
|
|
|
+ x,
|
|
|
+ y
|
|
|
+ } = Potree.Utils.getPointerPosAtHeight(0, e.pointer);
|
|
|
+ position = new Vector3(x, y, 0);
|
|
|
+ }
|
|
|
+ this.updateTitlePos(position);
|
|
|
+ this.dispatchEvent({
|
|
|
+ type: 'titlePosChanged',
|
|
|
+ position,
|
|
|
+ root: ((_e$intersect3 = e.intersect) === null || _e$intersect3 === void 0 ? void 0 : _e$intersect3.pointcloud) || ((_e$intersect4 = e.intersect) === null || _e$intersect4 === void 0 ? void 0 : _e$intersect4.object)
|
|
|
+ });
|
|
|
+ } else if (e.target.name == 'lineDragPoint') {
|
|
|
+ this.dragLineLen(e);
|
|
|
}
|
|
|
- this.updateTitlePos(position);
|
|
|
- this.dispatchEvent({
|
|
|
- type: 'titlePosChanged',
|
|
|
- position,
|
|
|
- root: ((_e$intersect3 = e.intersect) === null || _e$intersect3 === void 0 ? void 0 : _e$intersect3.pointcloud) || ((_e$intersect4 = e.intersect) === null || _e$intersect4 === void 0 ? void 0 : _e$intersect4.object)
|
|
|
- });
|
|
|
}
|
|
|
- });
|
|
|
+ }));
|
|
|
}
|
|
|
{
|
|
|
//和measure不同的是它的边是连在一起的一整条
|
|
@@ -49741,6 +49795,27 @@
|
|
|
|
|
|
viewer.dispatchEvent('content_changed');
|
|
|
}
|
|
|
+ setLineHeight(len) {
|
|
|
+ this.lineHeight = parseFloat(len);
|
|
|
+ this.titleLabel.position.z = this.lineHeight;
|
|
|
+ this.titleLabel.updatePose();
|
|
|
+ LineDraw.updateLine(this.titleLine, [new Vector3(0, 0, 0), new Vector3(0, 0, this.lineHeight)]);
|
|
|
+ }
|
|
|
+ dragLineLen(e) {
|
|
|
+ //拖拽线的顶端修改线长度
|
|
|
+ var endPos = this.titleLabel.getWorldPosition(new Vector3());
|
|
|
+ var normal = new Vector3(0, 0, 1);
|
|
|
+ var projected = endPos.clone().project(e.drag.dragViewport.camera);
|
|
|
+ projected.x = e.pointer.x;
|
|
|
+ projected.y = e.pointer.y;
|
|
|
+ var unprojected = projected.clone().unproject(e.drag.dragViewport.camera);
|
|
|
+ var moveVec = new Vector3().subVectors(unprojected, endPos);
|
|
|
+ moveVec = moveVec.projectOnVector(normal);
|
|
|
+ var newLength = Math.max(0, this.lineHeight + moveVec.dot(normal));
|
|
|
+ //console.log(moveVec,newLength)
|
|
|
+ this.setLineHeight(newLength);
|
|
|
+ this.dispatchEvent('dragLineLen');
|
|
|
+ }
|
|
|
updateEdge() {
|
|
|
if (this.lastUpdatePoints_ && Potree.Common.ifSame(this.lastUpdatePoints_, this.points) && this.halfPathWidth == this.lastHalfPathWidth) return; //没变 不更新
|
|
|
//this.edge.geometry = MeshDraw.getExtrudeGeo(edgeExtrudePoints, null, {extrudePath: this.points, openEnded:true, shapeDontClose:true/* , dontSmooth:true, steps: this.points.length-1 */})
|
|
@@ -60931,7 +61006,7 @@
|
|
|
};
|
|
|
var planeGeo$3 = new PlaneBufferGeometry(1, 1);
|
|
|
var texLoader$8 = new TextureLoader();
|
|
|
- var lineMat, dragPointMat;
|
|
|
+ var lineMat, dragPointMat$1;
|
|
|
var defaultLineLength = 1;
|
|
|
var defaultSpotScale = 0.35;
|
|
|
var titleHeight = {
|
|
@@ -61019,9 +61094,9 @@
|
|
|
this.add(group);
|
|
|
this.add(this.line);
|
|
|
viewer.tags.add(this);
|
|
|
- if (!dragPointMat) {
|
|
|
+ if (!dragPointMat$1) {
|
|
|
var map = texLoader$8.load(Potree.resourcePath + '/textures/whiteCircle.png', () => {});
|
|
|
- dragPointMat = {
|
|
|
+ dragPointMat$1 = {
|
|
|
default: new MeshBasicMaterial({
|
|
|
map,
|
|
|
transparent: true,
|
|
@@ -61038,18 +61113,20 @@
|
|
|
})
|
|
|
};
|
|
|
}
|
|
|
- this.lineDragPoint = new Mesh(planeGeo$3, dragPointMat.default); //修改线高度时出现的小圆点
|
|
|
- this.lineDragPoint.scale.set(0.2, 0.2, 0.2);
|
|
|
+ this.lineDragPoint = new Mesh(planeGeo$3, dragPointMat$1.default); //修改线高度时出现的小圆点
|
|
|
+ this.lineDragPoint.scale.set(0.15, 0.15, 0.15);
|
|
|
this.lineDragPoint.name = 'lineDragPoint';
|
|
|
this.lineDragPoint.renderOrder = this.lineDragPoint.pickOrder = Potree.config.renderOrders.tag.spot + 3;
|
|
|
group.add(this.lineDragPoint);
|
|
|
this.updatePose();
|
|
|
}
|
|
|
bindEvent() {
|
|
|
- var hoverState = {
|
|
|
- line: 0,
|
|
|
- spot: 0,
|
|
|
- label: 0
|
|
|
+ var hoverState = {},
|
|
|
+ grabbingObject;
|
|
|
+ var setDragPointState = state => {
|
|
|
+ this.lineDragPoint.material = state ? dragPointMat$1.hover : dragPointMat$1.default;
|
|
|
+ this.spot.material.opacity = state ? 0.5 : 1;
|
|
|
+ this.titleLabel.sprite.material.opacity = state ? 0.5 : 1;
|
|
|
};
|
|
|
{
|
|
|
//因为只有有intersect时才能拖拽,所以写得比较麻烦
|
|
@@ -61099,9 +61176,13 @@
|
|
|
}));
|
|
|
[this.line, this.spot, this.lineDragPoint].forEach(e => e.addEventListener('startDragging', e => {
|
|
|
this.dragEnable && (viewer.inputHandler.intersect || e.target.name == 'lineDragPoint') && setCursor('grabbing', 'add');
|
|
|
+ grabbingObject = e.target.name;
|
|
|
+ grabbingObject == 'lineDragPoint' && setDragPointState(true);
|
|
|
}));
|
|
|
[this.line, this.spot, this.lineDragPoint].forEach(e => e.addEventListener('drop', e => {
|
|
|
this.dragEnable && setCursor('grabbing', 'remove');
|
|
|
+ grabbingObject = null;
|
|
|
+ hoverState['lineDragPoint'] || setDragPointState(false);
|
|
|
}));
|
|
|
//拖拽线来移动。虽然理想方式是拟真,拖拽时不改变在线上的位置,使之平移,但仔细想想似乎办不到。因为墙面normal是不固定的,尤其在交界处难以确定。不知鼠标在空中的位置,即使是平行镜头移动也无法满足所有情况。matterport是加了底座,移动也是改变底座中心。
|
|
|
}
|
|
@@ -61132,20 +61213,11 @@
|
|
|
|
|
|
// CursorDeal
|
|
|
this.lineDragPoint.addEventListener('mouseover', e => {
|
|
|
- this.lineDragPoint.material = dragPointMat.hover;
|
|
|
- this.spot.material.opacity = 0.5;
|
|
|
- CursorDeal.add('hoverGrab');
|
|
|
+ setDragPointState(true);
|
|
|
});
|
|
|
this.lineDragPoint.addEventListener('mouseleave', e => {
|
|
|
- this.lineDragPoint.material = dragPointMat.default;
|
|
|
- this.spot.material.opacity = 1;
|
|
|
+ grabbingObject != 'lineDragPoint' && setDragPointState(false);
|
|
|
});
|
|
|
- /* this.lineDragPoint.addEventListener('drag',(e)=>{
|
|
|
-
|
|
|
- })
|
|
|
- this.lineDragPoint.addEventListener('drop',(e)=>{
|
|
|
-
|
|
|
- }) */
|
|
|
}
|
|
|
updateDepthParams() {
|
|
|
//为了避免热点嵌入墙壁,实时根据其大小更新材质系数。 但是在倾斜的角度看由于遮挡距离很大肯定会嵌入的
|
|
@@ -61189,8 +61261,9 @@
|
|
|
var moveVec = new Vector3().subVectors(unprojected, endPos);
|
|
|
moveVec = moveVec.projectOnVector(normal);
|
|
|
var newLength = Math.max(0, this.lineLength + moveVec.dot(normal));
|
|
|
- console.log(moveVec, newLength);
|
|
|
+ //console.log(moveVec,newLength)
|
|
|
this.changeLineLen(newLength);
|
|
|
+ this.dispatchEvent('dragLineLen');
|
|
|
}
|
|
|
changePos(info) {
|
|
|
//注:onMesh时在非平地上拖拽,热点旋转会一直变
|