|
@@ -53134,7 +53134,7 @@
|
|
|
funcs: [],
|
|
|
counter: 0,
|
|
|
uniqueID: 0,
|
|
|
- start: function(func, duration, done, delay, ease, name, id, cancelFun, ignoreFirstFrame=true) {
|
|
|
+ start: function(func, duration, done, delay, ease, name, id, cancelFun, ignoreFirstFrame=true, forbitCancel) {
|
|
|
return delay = delay || 0,
|
|
|
this.funcs.push({
|
|
|
func: func,
|
|
@@ -53151,6 +53151,7 @@
|
|
|
cancelFun : cancelFun, //取消时执行的函数
|
|
|
updateCount:0,
|
|
|
ignoreFirstFrame,
|
|
|
+ forbitCancel,
|
|
|
}),
|
|
|
func(0, 16),
|
|
|
this.counter += 1,
|
|
@@ -53250,7 +53251,7 @@
|
|
|
var t = void 0 === e ? 0 : e;
|
|
|
let cancels = [];
|
|
|
this.funcs = this.funcs.filter(function(e) {
|
|
|
- var is = e.id == t;
|
|
|
+ var is = e.id == t && !e.forbitCancel;
|
|
|
|
|
|
if(is && dealCancelFun){
|
|
|
e.cancelFun && cancels.push(e.cancelFun);
|
|
@@ -54069,6 +54070,11 @@
|
|
|
setView( info = {}){
|
|
|
// position, target, duration = 0, callback = null, onUpdate = null, Easing='', cancelFun
|
|
|
this.cancelFlying();
|
|
|
+ if(this.isFlying()){
|
|
|
+ if(info.cancelFun)info.cancelFun();
|
|
|
+ return ;//取消失败
|
|
|
+ }
|
|
|
+
|
|
|
let posWaitDone, rotWaitDone , dir;
|
|
|
|
|
|
let posDone = ()=>{
|
|
@@ -54160,7 +54166,7 @@
|
|
|
}
|
|
|
posWaitDone = false;
|
|
|
info.cancelFun && info.cancelFun();
|
|
|
- }, info.ignoreFirstFrame);
|
|
|
+ }, info.ignoreFirstFrame,info.forbitCancel);
|
|
|
}
|
|
|
|
|
|
if(endQuaternion || endYaw != void 0){
|
|
@@ -54182,26 +54188,13 @@
|
|
|
//中途取消
|
|
|
rotWaitDone = false;
|
|
|
info.cancelFun && info.cancelFun();
|
|
|
- }, info.ignoreFirstFrame);
|
|
|
+ }, info.ignoreFirstFrame, info.forbitCancel);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- /* transitions.start(lerp.vector(this.position, endPosition, (pos, progress)=>{
|
|
|
- let t = progress
|
|
|
-
|
|
|
- if(endQuaternion){
|
|
|
- let quaternion = (new THREE.Quaternion()).copy(startQuaternion)
|
|
|
- lerp.quaternion(quaternion, endQuaternion)(progress),
|
|
|
- this.rotation = new THREE.Euler().setFromQuaternion(quaternion)
|
|
|
- }
|
|
|
- this.restrictPos()
|
|
|
- //console.log('setView flying')
|
|
|
-
|
|
|
- info.onUpdate && info.onUpdate(t)//add
|
|
|
- }), info.duration, done, 0, info.Easing ? easing[info.Easing] : easing.easeInOutSine ,null, this.LookTransition, info.cancelFun); //easeInOutQuad
|
|
|
- */
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -54322,17 +54315,17 @@
|
|
|
};
|
|
|
|
|
|
let callback = info.callback;
|
|
|
- info.callback = ()=>{
|
|
|
+ info.callback = info.cancelFun = ()=>{
|
|
|
viewport.camera = info.endCamera;
|
|
|
viewer.scene.measurements.forEach((e)=>{
|
|
|
Potree.Utils.updateVisible(e, 'tranCamera', true);
|
|
|
});
|
|
|
viewer.dispatchEvent({type:'camera_changed', viewport:viewer.mainViewport, changeInfo:{}});//update sprite
|
|
|
-
|
|
|
+
|
|
|
|
|
|
callback && callback();
|
|
|
};
|
|
|
-
|
|
|
+ info.forbitCancel = true;
|
|
|
|
|
|
viewer.scene.measurements.forEach((e)=>{
|
|
|
Potree.Utils.updateVisible(e, 'tranCamera', false); //含sprite且实时更新size的都要隐藏
|
|
@@ -71278,6 +71271,7 @@ void main()
|
|
|
this.textColor = options.textColor || {r: 0, g: 0, b: 0, a: 1.0};
|
|
|
this.borderColor = options.borderColor || { r: 0, g: 0, b: 0, a: 0.0 };
|
|
|
this.borderRadius = options.borderRadius || 6;
|
|
|
+ this.margin = options.margin;
|
|
|
if(options.text != void 0)this.setText(options.text);
|
|
|
this.name = options.name;
|
|
|
|
|
@@ -71333,21 +71327,29 @@ void main()
|
|
|
//context["font-weight"] = 100; //语法与 CSS font 属性相同。
|
|
|
// get size data (height depends only on font size)
|
|
|
|
|
|
- //this.text = '啊啊啊啊啊啊fag'
|
|
|
+ //this.text = 'f 啊啊啊 jg'
|
|
|
|
|
|
let metrics = context.measureText(this.text );
|
|
|
let textWidth = metrics.width;
|
|
|
- let margin = new Vector2(this.fontsize, Math.max( this.fontsize*0.4, 10) );
|
|
|
+ let margin = this.margin || new Vector2(this.fontsize, Math.max( this.fontsize*0.4, 10) );
|
|
|
let spriteWidth = 2 * margin.x + textWidth + 2 * this.rectBorderThick;
|
|
|
let spriteHeight = 2 * margin.y + this.fontsize + 2 * this.rectBorderThick;
|
|
|
context.canvas.width = spriteWidth;
|
|
|
context.canvas.height = spriteHeight;
|
|
|
context.font = this.fontWeight + ' ' + this.fontsize + 'px ' + this.fontface;
|
|
|
|
|
|
+
|
|
|
+ let expand = Math.max(1, Math.pow(this.fontsize / 16, 1.3)); // 针对英文大部分在baseLine之上所以降低一点,或者可以识别当不包含jgqp时才加这个值
|
|
|
|
|
|
- let diff = 2;//针对英文大部分在baseLine之上所以降低一点(metrics.fontBoundingBoxAscent - metrics.fontBoundingBoxDescent) / 2
|
|
|
-
|
|
|
- context.textBaseline = "middle";
|
|
|
+ //canvas原点在左上角
|
|
|
+ context.textBaseline = 'alphabetic'; // "middle" //设置文字基线。当起点y设置为0时,只有该线以下的部分被绘制出来。middle时文字显示一半(但是对该字体所有字的一半,有的字是不一定显示一半的,尤其汉字),alphabetic时是英文字母的那条基线。
|
|
|
+
|
|
|
+ let actualHeight = metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent; // 当前文本字符串在这个字体下用的实际高度
|
|
|
+
|
|
|
+ //文字y向距离从textBaseline向上算
|
|
|
+ let y = metrics.actualBoundingBoxAscent + margin.y + expand;
|
|
|
+ //console.log(this.text, 'y' , y, 'actualBoundingBoxAscent', metrics.actualBoundingBoxAscent,'expand',expand )
|
|
|
+
|
|
|
|
|
|
// border color
|
|
|
context.strokeStyle = 'rgba(' + this.borderColor.r + ',' + this.borderColor.g + ',' +
|
|
@@ -71365,12 +71367,12 @@ void main()
|
|
|
context.strokeStyle = 'rgba(' + this.textBorderColor.r + ',' + this.textBorderColor.g + ',' +
|
|
|
this.textBorderColor.b + ',' + this.textBorderColor.a + ')';
|
|
|
context.lineWidth = this.textBorderThick;
|
|
|
- context.strokeText(this.text , this.rectBorderThick + margin.x,spriteHeight/2 + diff );
|
|
|
+ context.strokeText(this.text , this.rectBorderThick + margin.x, y /* spriteHeight/2 + expand */ );
|
|
|
}
|
|
|
|
|
|
context.fillStyle = 'rgba(' + this.textColor.r + ',' + this.textColor.g + ',' +
|
|
|
this.textColor.b + ',' + this.textColor.a + ')';
|
|
|
- context.fillText(this.text , this.rectBorderThick + margin.x, spriteHeight/2 + diff );//x,y
|
|
|
+ context.fillText(this.text , this.rectBorderThick + margin.x, y /* spriteHeight/2 + expand */);//x,y
|
|
|
|
|
|
let texture = new Texture(canvas);
|
|
|
texture.minFilter = LinearFilter;
|
|
@@ -73613,10 +73615,8 @@ void main()
|
|
|
type: 'isVisible',
|
|
|
visible: shouldVisi,
|
|
|
reason,
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
|
|
@@ -73651,10 +73651,12 @@ void main()
|
|
|
update();
|
|
|
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ /*
|
|
|
+ 复杂案例: 如果物体默认隐藏, 当符合任何一个其他条件时可见,则可:
|
|
|
+ Potree.Utils.updateVisible(this, "default", false, 0 ) //默认隐藏
|
|
|
+ Potree.Utils.updateVisible(this, 条件名, ifShow, 1, ifShow?'add':'cancel' ) //其他的条件
|
|
|
+ */
|
|
|
+
|
|
|
Utils.getObjVisiByReason = function(object,reason){//获取在某条件下是否可见. 注: 用户在数据集选择可不可见为"datasetSelection"
|
|
|
if(object.visible)return true
|
|
|
else {
|
|
@@ -75273,7 +75275,7 @@ void main()
|
|
|
color:'#00C8AF',
|
|
|
default:{
|
|
|
color:"#2F8FFF",//"#00c7b2",
|
|
|
- opacity:0.7
|
|
|
+ opacity:0.8
|
|
|
},
|
|
|
highlight:{
|
|
|
color:"#2F8FFF",//"#00c7b2",
|
|
@@ -75286,7 +75288,7 @@ void main()
|
|
|
,
|
|
|
backColor:'#333333',
|
|
|
|
|
|
- lineWidth: 4,
|
|
|
+ lineWidth: 3,
|
|
|
|
|
|
textColor: "#FFFFFF"
|
|
|
|
|
@@ -81734,18 +81736,21 @@ void main()
|
|
|
const markerSizeInfo = {
|
|
|
minSize : 25 , maxSize : 65, nearBound : 0.2, farBound : 4,
|
|
|
};
|
|
|
- const labelSizeInfo = {width2d:200};
|
|
|
+ const labelSizeInfo = {width2d:190};
|
|
|
const mainLabelProp = {
|
|
|
backgroundColor: {r: defaultColor$1.r*255, g: defaultColor$1.g*255, b: defaultColor$1.b*255, a:config$1.measure.default.opacity},
|
|
|
textColor: {r: textColor.r*255, g: textColor.g*255, b: textColor.b*255, a: 1.0},
|
|
|
- fontsize:16,
|
|
|
- useDepth : true ,
|
|
|
+ fontsize: 14,
|
|
|
+ useDepth : true , borderRadius : 12, margin:{x:20,y:4},
|
|
|
renderOrder : 5, pickOrder:5,
|
|
|
};
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
const subLabelProp = {
|
|
|
- backgroundColor: {r: 255, g: 255, b: 255, a:1},
|
|
|
- textColor: {r: 0, g: 0, b:0, a: 1.0},
|
|
|
- fontsize:14,
|
|
|
+ backgroundColor: {r: 255, g: 255, b: 255, a:config$1.measure.default.opacity},
|
|
|
+ textColor: {r: 0.3, g: 0.3, b:0.3, a: 1.0},
|
|
|
+ fontsize:12, borderRadius : 12, margin:{x:20,y:4},
|
|
|
renderOrder : 4, pickOrder:4,
|
|
|
};
|
|
|
|
|
@@ -81929,9 +81934,9 @@ void main()
|
|
|
let center = new Vector3().addVectors(p1,p2).multiplyScalar(0.5);
|
|
|
label.setPos(center);
|
|
|
distance = distance == void 0 ? p1.distanceTo(p2) : distance;
|
|
|
- var text = viewer.unitConvert.convert(distance, 'distance', Potree.settings.precision, this.unitSystem, 0.1 , true);//distance要传0.1 这个factor
|
|
|
+ var text = this.labelText || viewer.unitConvert.convert(distance, 'distance', Potree.settings.precision, this.unitSystem, 0.1 , true);//distance要传0.1 这个factor
|
|
|
label.setText(text);
|
|
|
- return distance
|
|
|
+
|
|
|
};
|
|
|
|
|
|
|
|
@@ -81947,10 +81952,10 @@ void main()
|
|
|
let previousPoint = this.points[previousIndex];
|
|
|
|
|
|
|
|
|
- if(this.showDistances){ // edge labels
|
|
|
+ if(this.showDistances || this.labelText){ // edge labels
|
|
|
let edgeLabel = this.edgeLabels[index];
|
|
|
- let distance = point.distanceTo(nextPoint);
|
|
|
- edgeLabel.shouldVisi = (index < lastIndex || this.isRect || this.closed && !this.isNew ) && distance>0;
|
|
|
+ let distance = this.labelText || point.distanceTo(nextPoint);
|
|
|
+ edgeLabel.shouldVisi = this.labelText || (index < lastIndex || this.isRect || this.closed && !this.isNew ) && distance>0;
|
|
|
/* this.closed || */edgeLabel.setVisible(edgeLabel.shouldVisi);
|
|
|
if(edgeLabel.visible){
|
|
|
setEdgeLabel(edgeLabel,point,nextPoint,distance);
|
|
@@ -82108,6 +82113,7 @@ void main()
|
|
|
}
|
|
|
}
|
|
|
this.isEditing = state;
|
|
|
+ viewer.dispatchEvent({type:'MeasureDragChange',state});
|
|
|
}
|
|
|
|
|
|
|
|
@@ -82173,8 +82179,8 @@ void main()
|
|
|
//this.closed || this.edgeLabels.forEach(e=>e.elem.addClass('highLight') )
|
|
|
this.setEdgesDisplay(true, hoverObject=="screenshot");
|
|
|
|
|
|
- this.areaLabel && setLabelHightState(this.areaLabel, true);
|
|
|
- this.closed || this.edgeLabels.forEach(e=>setLabelHightState(e, true) );
|
|
|
+ this.areaLabel && this.setLabelHightState(this.areaLabel, true);
|
|
|
+ this.closed || this.edgeLabels.forEach(e=>this.setLabelHightState(e, true) );
|
|
|
|
|
|
}else {
|
|
|
this.markers.forEach(e=>this.setMarkerSelected(e, 'unhover', 'selectAll' ));
|
|
@@ -82183,8 +82189,8 @@ void main()
|
|
|
this.setEdgesDisplay(false, hoverObject=="screenshot");
|
|
|
//this.areaLabel && this.areaLabel.elem.removeClass('highLight')
|
|
|
//this.closed || this.edgeLabels.forEach(e=>e.elem.removeClass('highLight') )
|
|
|
- this.areaLabel && setLabelHightState(this.areaLabel, false);
|
|
|
- this.closed || this.edgeLabels.forEach(e=>setLabelHightState(e, false) );
|
|
|
+ this.areaLabel && this.setLabelHightState(this.areaLabel, false);
|
|
|
+ this.closed || this.edgeLabels.forEach(e=>this.setLabelHightState(e, false) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -82199,6 +82205,32 @@ void main()
|
|
|
viewer.mapViewer && viewer.mapViewer.dispatchEvent('content_changed');
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ setLabelHightState(label, state){
|
|
|
+ if(state){
|
|
|
+ label.backgroundColor = {r:255, g:255, b:255, a:config$1.measure.highlight.opacity},
|
|
|
+ //label.backgroundColor.a = config.measure.highlight.opacity
|
|
|
+ label.sprite.material.useDepth = false;
|
|
|
+ label.textColor = {r: this.color.r*255, g: this.color.g*255, b: this.color.b*255, a: 1};
|
|
|
+ }else {
|
|
|
+ label.backgroundColor = {r: this.color.r*255, g: this.color.g*255, b: this.color.b*255, a:config$1.measure.default.opacity};
|
|
|
+ //label.backgroundColor.a = config.measure.default.opacity
|
|
|
+ label.sprite.material.useDepth = true;
|
|
|
+ label.textColor = {r: 255, g: 255, b: 255, a: 1};
|
|
|
+
|
|
|
+ }
|
|
|
+ label.updateTexture();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
removeMarker(index ){
|
|
|
super.removeMarker(index);
|
|
|
|
|
@@ -82448,7 +82480,7 @@ void main()
|
|
|
transparent: !0,
|
|
|
opacity: 1,
|
|
|
map: texLoader$2.load(Potree.resourcePath+'/textures/pic_point32.png' ),
|
|
|
- useDepth:true ,
|
|
|
+ //useDepth:true ,
|
|
|
replaceColor:this.color,
|
|
|
beReplacedRed: 0.184, //0.18431372
|
|
|
mapColorReplace:true
|
|
@@ -82469,7 +82501,7 @@ void main()
|
|
|
dashSize: 0.1,
|
|
|
gapSize: 0.02,
|
|
|
dashed: true,
|
|
|
- lineWidth: config$1.measure.lineWidth
|
|
|
+ lineWidth: 2
|
|
|
})
|
|
|
};
|
|
|
|
|
@@ -82593,7 +82625,12 @@ void main()
|
|
|
prop.maxMarkers = 2,
|
|
|
prop.minMarkers = 2,
|
|
|
prop.faceDirection = "horizontal";
|
|
|
-
|
|
|
+ }else if(prop.measureType == "Hor LINE with Text"){ //add
|
|
|
+ prop.showEdges = true,
|
|
|
+ prop.maxMarkers = 2,
|
|
|
+ prop.minMarkers = 2,
|
|
|
+ prop.faceDirection = "horizontal";
|
|
|
+
|
|
|
}else if(prop.measureType == 'Area'){
|
|
|
prop.showDistances = true,
|
|
|
prop.atPlane = true,
|
|
@@ -82777,37 +82814,6 @@ void main()
|
|
|
|
|
|
|
|
|
|
|
|
- function setLabelHightState(label, state){
|
|
|
- /* if(state){
|
|
|
- label.backgroundColor = {r: highlightColor.r*255, g: highlightColor.g*255, b: highlightColor.b*255, a:config.measure.highlight.opacity},
|
|
|
- label.backgroundColor.a = config.measure.highlight.opacity
|
|
|
- label.sprite.material.useDepth = false;
|
|
|
-
|
|
|
- }else{
|
|
|
- label.backgroundColor = mainLabelProp.backgroundColor
|
|
|
- label.backgroundColor.a = config.measure.default.opacity
|
|
|
- label.sprite.material.useDepth = true
|
|
|
-
|
|
|
- } */
|
|
|
-
|
|
|
- if(state){
|
|
|
- //label.backgroundColor = {r: this.color[0]*255, g: this.color[1]*255, b: this.color[2]*255, a:config.measure.highlight.opacity},
|
|
|
- label.backgroundColor.a = config$1.measure.highlight.opacity;
|
|
|
- label.sprite.material.useDepth = false;
|
|
|
-
|
|
|
- }else {
|
|
|
- //label.backgroundColor = {r: this.color[0]*255, g: this.color[1]*255, b: this.color[2]*255
|
|
|
- label.backgroundColor.a = config$1.measure.default.opacity;
|
|
|
- label.sprite.material.useDepth = true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- label.updateTexture();
|
|
|
- //label.sprite.material.needsUpdate = true
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
|
|
|
function createCircleRadiusLabel$1(){
|
|
|
const circleRadiusLabel = new TextSprite$2("");
|
|
@@ -88599,9 +88605,9 @@ void main()
|
|
|
var width_ = width * view.width;
|
|
|
var height_ = height * view.height;
|
|
|
|
|
|
+ view.setResolution(Math.ceil(width_), Math.ceil(height_), width, height ); //本来应该是floor,但是这样奇数时会少一个像素,导致向左移一个像素且宽度少1。现在则多绘制1个像素,超出的1个像素应该不会绘制出来(但不知道其他地方是否有偏差,比如pick时)
|
|
|
if(height_ == 0)return //avoid NAN
|
|
|
|
|
|
- view.setResolution(Math.ceil(width_), Math.ceil(height_), width, height ); //本来应该是floor,但是这样奇数时会少一个像素,导致向左移一个像素且宽度少1。现在则多绘制1个像素,超出的1个像素应该不会绘制出来(但不知道其他地方是否有偏差,比如pick时)
|
|
|
let aspect = width_ / height_; //camera的参数精确些,不用视口的归整的resolution像素值,否则hasChange无法为true, 导致canvasResize了但map没update从而闪烁
|
|
|
view.camera.aspect = aspect;
|
|
|
|
|
@@ -89654,7 +89660,7 @@ void main()
|
|
|
|
|
|
|
|
|
|
|
|
- let canUseDepthTex = (Potree.settings.displayMode == 'showPanos' || useDepthTex)
|
|
|
+ let canUseDepthTex = !Potree.settings.unableUseDepTexPick && (Potree.settings.displayMode == 'showPanos' || useDepthTex)
|
|
|
&& viewer.images360.currentPano.pointcloud.hasDepthTex && viewport == viewer.mainViewport && !usePointcloud;
|
|
|
|
|
|
|
|
@@ -89735,7 +89741,7 @@ void main()
|
|
|
//点云费时:2-15ms
|
|
|
//深度图费时: 0.1-0.2ms
|
|
|
|
|
|
-
|
|
|
+ this.viewer.dispatchEvent({type:'getIntersect', intersect});
|
|
|
|
|
|
if(onlyGetIntersect){
|
|
|
return intersect
|
|
@@ -89799,11 +89805,9 @@ void main()
|
|
|
|
|
|
let dontIntersect = this.drag && viewport.alignment || isFlying; /* viewer.images360.flying */ // flying 时可能卡顿
|
|
|
//console.log('dontIntersectPointcloud',dontIntersectPointcloud)
|
|
|
-
|
|
|
- /* if(e.onlyGetIntersect ) */intersect = this.getIntersect(viewport, e.onlyGetIntersect, e.pickWindowSize, !!dontIntersect, e.whichPointcloud); //数据集多的时候卡顿
|
|
|
- /* else Potree.Common.intervalTool.isWaiting('getIntersect', ()=>{
|
|
|
- this.intersect = this.getIntersect(viewport, e.onlyGetIntersect, e.pickWindowSize, !!dontIntersect, e.whichPointcloud) //数据集多的时候卡顿
|
|
|
- }, 156); */
|
|
|
+
|
|
|
+ intersect = this.getIntersect(viewport, e.onlyGetIntersect, e.pickWindowSize, !!dontIntersect, e.whichPointcloud || e.usePointcloud || this.drag); //深度图不准,尽量用点云
|
|
|
+
|
|
|
|
|
|
//console.log('intersectPoint', intersectPoint)
|
|
|
}
|
|
@@ -91535,41 +91539,34 @@ void main()
|
|
|
|
|
|
//不过平板无hover事件
|
|
|
faceMesh.addEventListener('mouseover', (e)=>{
|
|
|
- if(navCubeViewer.changingView)return
|
|
|
+ if(viewer.mainViewport.view.isFlying())return
|
|
|
faceMesh.material.uniforms.faceColor.value.set(Colors.blue);
|
|
|
//console.log('变', name)
|
|
|
navCubeViewer.dispatchEvent('content_changed');
|
|
|
});
|
|
|
faceMesh.addEventListener('mouseleave', (e)=>{
|
|
|
- if(navCubeViewer.changingView)return
|
|
|
+ if(viewer.mainViewport.view.isFlying())return
|
|
|
faceMesh.material.uniforms.faceColor.value.set(Colors.black);
|
|
|
//console.log('回', name)
|
|
|
navCubeViewer.dispatchEvent('content_changed');
|
|
|
});
|
|
|
|
|
|
faceMesh.addEventListener('click', (e)=>{
|
|
|
- if(navCubeViewer.switchView('ortho', directions[name] , ()=>{
|
|
|
- faceMesh.material.uniforms.faceColor.value.set(Colors.black);
|
|
|
+ /* if(navCubeViewer.switchView('ortho', directions[name] , ()=>{
|
|
|
+ faceMesh.material.uniforms.faceColor.value.set(Colors.black)
|
|
|
}) ){
|
|
|
- faceMesh.material.uniforms.faceColor.value.set(Colors.blue);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- if(name == 'Top'){
|
|
|
- navCubeViewer.addEventListener('enterTopView',()=>{
|
|
|
- faceMesh.dispatchEvent('click');
|
|
|
-
|
|
|
- });
|
|
|
- navCubeViewer.addEventListener('leaveTopView',()=>{
|
|
|
- if(navCubeViewer.lastView){
|
|
|
- navCubeViewer.switchView2(navCubeViewer.lastView);
|
|
|
- }
|
|
|
- });
|
|
|
+ faceMesh.material.uniforms.faceColor.value.set(Colors.blue)
|
|
|
+ } */
|
|
|
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
+ if(viewer.mainViewport.view.isFlying())return
|
|
|
+ navCubeViewer.switchView('ortho', directions[name] , ()=>{
|
|
|
+ faceMesh.material.uniforms.faceColor.value.set(Colors.black);
|
|
|
+ });
|
|
|
+ faceMesh.material.uniforms.faceColor.value.set(Colors.blue);
|
|
|
+ });
|
|
|
});
|
|
|
+
|
|
|
};
|
|
|
|
|
|
|
|
@@ -91692,6 +91689,24 @@ void main()
|
|
|
});
|
|
|
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
+ //外部传消息,使进入俯视
|
|
|
+ this.addEventListener('enterTopView',()=>{
|
|
|
+ let baseLine = viewer.scene.measurements.find(e=>e.isBaseLine); //使基准线在俯视图中水平
|
|
|
+ let yaw = baseLine ? new Vector2().subVectors(baseLine.points[0], baseLine.points[1]).angle() : 0;
|
|
|
+ this.switchView('ortho', {dir: new Vector3(0,0,-1),yaw,pitch: -1.5707963267948966});
|
|
|
+ });
|
|
|
+ this.addEventListener('leaveTopView',()=>{
|
|
|
+ if(this.lastView){
|
|
|
+ this.switchView2(this.lastView);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
|
|
|
|
|
@@ -91785,7 +91800,7 @@ void main()
|
|
|
}
|
|
|
} */
|
|
|
switchView(type, {yaw, pitch, dir}={}, done){
|
|
|
- if(this.changingView)return
|
|
|
+ if(viewer.mainViewport.view.isFlying())return
|
|
|
let view = viewer.mainViewport.view;
|
|
|
this.lastView = view.clone();
|
|
|
if(viewer.mainViewport.camera.type == 'OrthographicCamera'){
|
|
@@ -91823,11 +91838,11 @@ void main()
|
|
|
endPitch: pitch, endYaw: yaw , dir, startCamera, endCamera
|
|
|
}).promise.done(()=>{
|
|
|
//viewer.dispatchEvent('reachTopView')
|
|
|
- this.changingView = false;
|
|
|
+
|
|
|
done && done();
|
|
|
navCubeViewer.dispatchEvent('content_changed');
|
|
|
});
|
|
|
- this.changingView = true;
|
|
|
+
|
|
|
}else {
|
|
|
|
|
|
if(viewer.mainViewport.camera == viewer.scene.cameraO){
|
|
@@ -91853,14 +91868,14 @@ void main()
|
|
|
view.tranCamera(viewer.mainViewport, { position ,
|
|
|
callback:()=>{
|
|
|
done && done();
|
|
|
- this.changingView = false;
|
|
|
+
|
|
|
}, startCamera:viewer.scene.cameraO, endCamera:viewer.scene.cameraP, midCamera:viewer.scene.cameraBasic
|
|
|
}, 500);
|
|
|
- this.changingView = true;
|
|
|
+
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- return this.changingView
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -91868,10 +91883,10 @@ void main()
|
|
|
|
|
|
|
|
|
switchView2(viewInfo){ //直接输入view改变
|
|
|
- if(this.changingView)return
|
|
|
+
|
|
|
let view = viewer.mainViewport.view;
|
|
|
let startCamera, endCamera;
|
|
|
- this.changingView = true;
|
|
|
+
|
|
|
|
|
|
if(viewInfo.isOrtho){
|
|
|
if(viewer.mainViewport.camera != viewer.scene.cameraO){
|
|
@@ -91883,7 +91898,7 @@ void main()
|
|
|
view.moveOrthoCamera(viewer.mainViewport, {endPosition:viewInfo.position,
|
|
|
endPitch: viewInfo.pitch, endYaw: viewInfo.yaw , zoom: viewInfo.zoom,
|
|
|
callback:()=>{
|
|
|
- this.changingView = false;
|
|
|
+
|
|
|
},
|
|
|
}, 500);
|
|
|
}
|
|
@@ -91897,7 +91912,7 @@ void main()
|
|
|
endPitch: viewInfo.pitch, endYaw: viewInfo.yaw ,
|
|
|
startCamera, endCamera,
|
|
|
callback:()=>{
|
|
|
- this.changingView = false;
|
|
|
+
|
|
|
},
|
|
|
}, 500);
|
|
|
}
|
|
@@ -91910,7 +91925,7 @@ void main()
|
|
|
endPitch: viewInfo.pitch, endYaw: viewInfo.yaw ,
|
|
|
startCamera, endCamera, midCamera:viewer.scene.cameraBasic ,
|
|
|
callback:()=>{
|
|
|
- this.changingView = false;
|
|
|
+
|
|
|
},
|
|
|
}, 500);
|
|
|
}
|
|
@@ -106040,48 +106055,38 @@ ENDSEC
|
|
|
});
|
|
|
|
|
|
var updateVisi = (e)=>{
|
|
|
- if(e.hoverViewport == viewer.mainViewport){
|
|
|
+ //if(e.hoverViewport == viewer.mainViewport){
|
|
|
Potree.Utils.updateVisible(this,"atViewport", true);
|
|
|
this.update(e.intersect && e.intersect.location);
|
|
|
- }else {
|
|
|
- Potree.Utils.updateVisible(this,"atViewport", false); //小地图不显示
|
|
|
- }
|
|
|
+ /* }else{
|
|
|
+ Potree.Utils.updateVisible(this,"atViewport", false) //小地图不显示
|
|
|
+ } */
|
|
|
|
|
|
};
|
|
|
|
|
|
- viewer.addEventListener('global_mousemove', updateVisi);
|
|
|
- viewer.addEventListener('global_touchstart', updateVisi);
|
|
|
+ //viewer.addEventListener('global_mousemove', updateVisi)
|
|
|
+ viewer.addEventListener('global_touchstart', updateVisi);
|
|
|
+ viewer.addEventListener('getIntersect', updateVisi);
|
|
|
|
|
|
|
|
|
- /* viewer.addEventListener("beginSplitView",()=>{
|
|
|
- this.updateVisible("splitView", false)
|
|
|
- })
|
|
|
- viewer.addEventListener("finishSplitView",()=>{
|
|
|
- this.updateVisible("splitView", true)
|
|
|
- }) */
|
|
|
-
|
|
|
+
|
|
|
|
|
|
this.addEventListener("setEnable",(e)=>{
|
|
|
- Potree.Utils.updateVisible(this, "enable", e.value); //界面开关
|
|
|
+ Potree.Utils.updateVisible(this, "enable", e.value, 1, e.value?'add':'cancel' ); //界面开关
|
|
|
/* if(Potree.settings.displayMode == 'showPanos') && e.value){
|
|
|
Potree.settings.pointDensity = 'magnifier'
|
|
|
}else if() */
|
|
|
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
- if(Potree.settings.isOfficial){
|
|
|
- Potree.Utils.updateVisible(this, "enable", false);
|
|
|
- }else {
|
|
|
- Potree.Utils.updateVisible(this, "measure", false);
|
|
|
- viewer.addEventListener("measureMovePoint",()=>{//测量开始
|
|
|
- Potree.Utils.updateVisible(this, "measure", true);
|
|
|
- });
|
|
|
- viewer.addEventListener("endMeasureMove",()=>{
|
|
|
- Potree.Utils.updateVisible(this, "measure", false);
|
|
|
- });
|
|
|
- }
|
|
|
+
|
|
|
+ //默认隐藏, 显示的条件:测量拖拽 或 外部消息setEnable
|
|
|
|
|
|
+ Potree.Utils.updateVisible(this, "default", false, 0); //默认隐藏
|
|
|
+
|
|
|
+ viewer.addEventListener("MeasureDragChange",(e)=>{//测量drag
|
|
|
+ Potree.Utils.updateVisible(this, "measure", e.state, 1, e.state?'add':'cancel');
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
viewer.scene.view.addEventListener('flyingDone',()=>{
|
|
|
if(!this.visible)return
|
|
@@ -106096,11 +106101,12 @@ ENDSEC
|
|
|
|
|
|
//注意:在鼠标没有移动的时候,无法获取到最新的intersect, 放大镜内的内容可能是错误的。全景模式下更奇怪,原因未知
|
|
|
update(aimPos){//相机靠近 navvis的做法
|
|
|
+
|
|
|
var dontRender = this.dontRender || !(aimPos instanceof Vector3) || Potree.settings.displayMode == 'showPanos' && viewer.images360.flying;
|
|
|
aimPos = aimPos instanceof Vector3 ? aimPos : this.aimPos;
|
|
|
if(!aimPos || !this.visible)return
|
|
|
|
|
|
-
|
|
|
+ //console.log('aimPos', aimPos)
|
|
|
|
|
|
var playerCamera = viewer.scene.getActiveCamera();
|
|
|
|