Browse Source

fix: 三个模型调整位置

xzw 11 months ago
parent
commit
0b9a741034

+ 313 - 57
public/lib/potree/potree.js

@@ -4239,7 +4239,7 @@
 
 	 */
 
-	var transitions = {
+	var transitions$1 = {
 	  globalDone: null,
 	  funcs: [],
 	  counter: 0,
@@ -4318,8 +4318,8 @@
 	    }
 	  },
 	  adjustSpeed: function adjustSpeed(e, t) {
-	    for (var u = this.getById(e), duration = 0; duration < u.length; duration++) {
-	      var r = u[duration];
+	    for (var u = this.getById(e), n = 0; n < u.length; n++) {
+	      var r = u[n];
 	      r.duration /= t, r.current /= t;
 	    }
 	  },
@@ -4593,8 +4593,11 @@
 	  },
 	  replaceAll: function replaceAll(str, f, e) {
 	    //f全部替换成e
-	    var reg = new RegExp(f, "g"); //创建正则RegExp对象  
-	    return str.replace(reg, e);
+
+	    if (str.replaceAll) return str.replaceAll(f, e);else {
+	      var reg = new RegExp(f, "g"); //创建正则RegExp对象  
+	      return str.replace(reg, e); //str.split(f).join(e);
+	    }
 	  },
 	  dealURL(url) {
 	    var urlNew = this.replaceAll(url, "\\+", "%2B"); // 浏览器似乎不支持访问带+的地址
@@ -4875,6 +4878,46 @@
 	    context.clearRect(0, 0, canvas.width, canvas.height);
 	    return dataUrl;
 	  },
+	  /* changeShaderToWebgl2(vs, fs, matType, otherReplaces=[]){//部分shader要根据webgl版本作更改
+	      if(!Potree.settings.isWebgl2)return {vs, fs}
+	      let turnTo300 = matType != 'ShaderMaterial' && (vs.includes('gl_FragDepthEXT') || fs.includes('gl_FragDepthEXT') ) 
+	      let addV300 = turnTo300 && matType != 'RawShaderMaterial' // RawShaderMaterial直接material.glslVersion = '300 es' 以加在define之前
+	      let change = (shader, shaderType)=>{ 
+	          let newShader = shader
+	          
+	          if(turnTo300){ //非shaderMaterial需要手动改为300 es的写法
+	              addV300 && (newShader = '#version 300 es \n' + newShader)   //需要加 #version 300 es。 three.js自带的渲染会自动加所以不用
+	              newShader = newShader.replaceAll('varying ', shaderType == 'vs' ? 'out ' : 'in ')
+	              newShader = newShader.replaceAll('attribute ', 'in ') 
+	              if(shaderType == 'fs'){
+	                  newShader = newShader.replaceAll('gl_FragColor', 'fragColor')
+	                  newShader = newShader.replace('void main', 'out vec4 fragColor;\n  void main' )//在void main前加入这个声明 
+	              }  
+	              newShader = newShader.replaceAll('gl_FragDepthEXT','gl_FragDepth')
+	          
+	              newShader = newShader.replaceAll('texture2D','texture')
+	              newShader = newShader.replaceAll('textureCube','texture')
+	          
+	          }
+	          
+	          newShader = newShader.replace('#extension GL_EXT_frag_depth : enable','') 
+	          newShader = newShader.replaceAll('defined(GL_EXT_frag_depth) &&','')
+	           
+	          
+	          otherReplaces.forEach(({oldStr,newStr})=>{
+	              newShader = newShader.replaceAll(oldStr,newStr)   
+	          })
+	              
+	          return newShader
+	      }
+	      
+	      vs = change(vs,'vs')
+	      fs = change(fs,'fs')
+	       
+	      //console.log('成功替换为webgl2' )
+	      return {vs,fs}
+	  }//three.js的shaderMaterial也有替换功能,搜 '#define gl_FragDepthEXT gl_FragDepth',
+	   */
 	  changeShaderToWebgl2(vs, fs, matType) {
 	    var otherReplaces = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
 	    //部分shader要根据webgl版本作更改
@@ -4889,24 +4932,24 @@
 	      if (turnTo300) {
 	        //非shaderMaterial需要手动改为300 es的写法
 	        addV300 && (newShader = '#version 300 es \n' + newShader); //需要加 #version 300 es。 three.js自带的渲染会自动加所以不用
-	        newShader = newShader.replaceAll('varying ', shaderType == 'vs' ? 'out ' : 'in ');
-	        newShader = newShader.replaceAll('attribute ', 'in ');
+	        newShader = this.replaceAll(newShader, 'varying ', shaderType == 'vs' ? 'out ' : 'in ');
+	        newShader = this.replaceAll(newShader, 'attribute ', 'in ');
 	        if (shaderType == 'fs') {
-	          newShader = newShader.replaceAll('gl_FragColor', 'fragColor');
+	          newShader = this.replaceAll(newShader, 'gl_FragColor', 'fragColor');
 	          newShader = newShader.replace('void main', 'out vec4 fragColor;\n  void main'); //在void main前加入这个声明 
 	        }
-	        newShader = newShader.replaceAll('gl_FragDepthEXT', 'gl_FragDepth');
-	        newShader = newShader.replaceAll('texture2D', 'texture');
-	        newShader = newShader.replaceAll('textureCube', 'texture');
+	        newShader = this.replaceAll(newShader, 'gl_FragDepthEXT', 'gl_FragDepth');
+	        newShader = this.replaceAll(newShader, 'texture2D', 'texture');
+	        newShader = this.replaceAll(newShader, 'textureCube', 'texture');
 	      }
 	      newShader = newShader.replace('#extension GL_EXT_frag_depth : enable', '');
-	      newShader = newShader.replaceAll('defined(GL_EXT_frag_depth) &&', '');
+	      newShader = this.replaceAll(newShader, 'defined(GL_EXT_frag_depth) &&', '');
 	      otherReplaces.forEach(_ref2 => {
 	        var {
 	          oldStr,
 	          newStr
 	        } = _ref2;
-	        newShader = newShader.replaceAll(oldStr, newStr);
+	        newShader = this.replaceAll(newShader, oldStr, newStr);
 	      });
 	      return newShader;
 	    };
@@ -5214,15 +5257,15 @@
 	  }
 	  isFlying() {
 	    var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all';
-	    var a = transitions.getById(this.FlyTransition).length > 0;
-	    var b = transitions.getById(this.LookTransition).length > 0;
+	    var a = transitions$1.getById(this.FlyTransition).length > 0;
+	    var b = transitions$1.getById(this.LookTransition).length > 0;
 	    return type == 'pos' ? a : type == 'rotate' ? b : a || b;
 	  }
 	  cancelFlying() {
 	    var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all';
 	    var dealCancel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
 	    //外界只能通过这个来cancel
-	    type == 'pos' ? transitions.cancelById(this.FlyTransition, dealCancel) : type == 'rotate' ? transitions.cancelById(this.LookTransition, dealCancel) : (transitions.cancelById(this.FlyTransition, dealCancel), transitions.cancelById(this.LookTransition, dealCancel));
+	    type == 'pos' ? transitions$1.cancelById(this.FlyTransition, dealCancel) : type == 'rotate' ? transitions$1.cancelById(this.LookTransition, dealCancel) : (transitions$1.cancelById(this.FlyTransition, dealCancel), transitions$1.cancelById(this.LookTransition, dealCancel));
 	    //console.log('cancelFlying ' , this.sid,  type)
 	  }
 	  setView() {
@@ -5313,7 +5356,7 @@
 	      var posChange = !this.position.equals(endPosition);
 	      if (posChange) {
 	        posWaitDone = true;
-	        transitions.start(lerp.vector(this.position, endPosition, (pos, progress, delta) => {
+	        transitions$1.start(lerp.vector(this.position, endPosition, (pos, progress, delta) => {
 	          info.onUpdate && info.onUpdate(progress, delta);
 	        }), info.duration, posDone, 0, info.Easing ? easing[info.Easing] : easing.easeInOutSine, null, this.FlyTransition, () => {
 	          //中途取消 
@@ -5331,7 +5374,7 @@
 	      }
 	      if (endQuaternion || endYaw != void 0) {
 	        rotWaitDone = true;
-	        transitions.start((progress, delta) => {
+	        transitions$1.start((progress, delta) => {
 	          if (endYaw != void 0) {
 	            this.yaw = startYaw * (1 - progress) + endYaw * progress;
 	            this.pitch = startPitch * (1 - progress) + endPitch * progress;
@@ -5425,7 +5468,7 @@
 
 	    var startZoom = camera.zoom;
 	    var pointerPos = new Vector3(pointer.x, pointer.y, 0.5);
-	    transitions.start(progress => {
+	    transitions$1.start(progress => {
 	      var oldPos = pointerPos.clone().unproject(camera);
 	      this.zoom = camera.zoom = endZoom * progress + startZoom * (1 - progress);
 	      camera.updateProjectionMatrix();
@@ -22614,7 +22657,7 @@
 	  isOfficial: false,
 	  webSite: 'testdata',
 	  //正式:'datav1', //不同环境对应的静态文件的地址不同
-
+	  // language : "zh"
 	  isLocal: false,
 	  //是否本地 局域网版本
 	  libsUrl: '../libs/',
@@ -23388,14 +23431,16 @@
 	    //if(Potree.settings.mapCompany == 'google')return 
 	    if (style == this.style) return;
 	    if (Potree.settings.mapCompany == 'google') {
-	      if (style == 'satellite') {
-	        //卫星
-	        this.baseUrl = "https://mt2.google.com/vt/lyrs=y@159000000&hl=zh-CN&gl=cn&x=${x}&y=${y}&z=${z}&s=mt1"; /* "http://mt2.google.cn/vt/lyrs=m@177000000&hl=zh-CN&gl=cn&src=app&x=${x}&y=${y}&z=${z}"  */ //最高只到19
-	        this.maxDepth = 22;
-	      } else {
-	        this.baseUrl = "https://mt2.google.com/vt/lyrs=m@159000000&hl=zh-CN&gl=cn&x=${x}&y=${y}&z=${z}&s=mt1"; /* "http://mt2.google.cn/vt/lyrs=m@177000000&hl=zh-CN&gl=cn&src=app&x=${x}&y=${y}&z=${z}"  */ //最高只到19
-	        this.maxDepth = 22;
-	      }
+	      var [lang, glPos] = {
+	        'zh': ["zh-CN", "cn"],
+	        'en': ["en-US"],
+	        //范围大所以不指定地理位置 。
+	        'ja': ["ja-JP", "JP"],
+	        'ko': ["ko-KR", "KR"]
+	      }[Potree.settings.language] || [];
+	      this.baseUrl = "https://mt2.google.com/vt/lyrs=" + (style == 'satellite' ? "y" : "m") + "@159000000" + (lang ? "&hl=" + lang : '') + (glPos ? "&gl=" + glPos : '') + "&x=${x}&y=${y}&z=${z}&s=mt1";
+	      this.maxDepth = 22;
+
 	      /* 1)lyrs= 表示的是图层类型,即瓦片类型,具体含义如下: 
 	      m:路线图 
 	      t:地形图 
@@ -23403,9 +23448,12 @@
 	      s:卫星图 
 	      y:带标签的卫星图 
 	      h:标签层(路名、地名等)
-	      2)& gl=CN 
+	      2)& gl=CN    指定地理区域
 	      谷歌地图针对中国有两套坐标,一套做了偏移,一套没有。经测试在url加入gl=cn地图会有偏移。 
-	      Tips:如果谷歌地图和RTK测量的WGS84坐标有偏差,可以尝试在url里去掉& gl=cn。
+	      Tips:如果谷歌地图和RTK测量的WGS84坐标有偏差,可以尝试在url里去掉& gl=cn。(摘自网上)
+	      
+	      通义千问:如果不指定gl参数,Google将使用默认值或基于其他因素(如IP地址)来推断用户的地理区域。这通常不会导致地图数据的不准确性,但可能会影响本地化信息的显示。地图上的标签(如街道名称、城市名称等)可能不会以最合适的语言显示。地址格式和拼写可能不符合当地标准
+	      
 	      5)&hl= 
 	      设置地图注记文字语言类型,缺省默认为中文。 
 	      hl=nl 中英双语 
@@ -27020,7 +27068,7 @@
 	  hoverOn() {
 	    var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 	    //console.log("hoverOn  " + this.id  ) 
-	    transitions.start(lerp.property(this.marker.material, "opacity", markerOpacitys.hovered, () => {
+	    transitions$1.start(lerp.property(this.marker.material, "opacity", markerOpacitys.hovered, () => {
 	      viewer.dispatchEvent('content_changed');
 	    }), this.marker.visible ? 250 : 0);
 	    if (!e.byMap) this.dispatchEvent({
@@ -27036,7 +27084,7 @@
 	  hoverOff() {
 	    var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 	    //console.log("hoverOff  " + this.id  )
-	    transitions.start(lerp.property(this.marker.material, "opacity", markerOpacitys.default, () => {
+	    transitions$1.start(lerp.property(this.marker.material, "opacity", markerOpacitys.default, () => {
 	      viewer.dispatchEvent('content_changed');
 	    }), this.marker.visible ? 250 : 0);
 	    if (!e.byMap) this.dispatchEvent({
@@ -30321,20 +30369,41 @@
 
 	        this.addEventListener('endChangeMode', e => {
 	          var _this$currentPano;
+	          /* if( this.currentPano?.pointcloud?.is4dkkModel){
+	              let model = this.currentPano.pointcloud
+	              if(model.fileType == '3dTiles'){ 
+	                  viewer.setAllTilesets(model, (child)=>{
+	                      child.runtime.limit2lowestDepth(e.mode == 'showPanos')
+	                      child.runtime.getTileset().tiles.forEach(e=>{ 
+	                          this.judgeModelMat(e.tileContent)  
+	                      }) 
+	                  }) 
+	              }else{
+	                  this.judgeModelMat(model)
+	              }
+	          } */
 	          if ((_this$currentPano = this.currentPano) !== null && _this$currentPano !== void 0 && (_this$currentPano = _this$currentPano.pointcloud) !== null && _this$currentPano !== void 0 && _this$currentPano.is4dkkModel) {
-	            var model = this.currentPano.pointcloud;
-	            if (model.fileType == '3dTiles') {
-	              viewer.setAllTilesets(model, child => {
-	                child.runtime.limit2lowestDepth(e.mode == 'showPanos');
-	                child.runtime.getTileset().tiles.forEach(e => {
-	                  this.judgeModelMat(e.tileContent);
-	                });
-	              });
-	            } else {
-	              this.judgeModelMat(model);
-	            }
+	            this.changeModelMat(this.currentPano.pointcloud);
 	          }
 	        });
+	        if (Potree.settings.canWalkThroughModel) {
+	          var lastModel;
+	          this.addEventListener('flyToPano', e => {
+	            //漫游到另一个模型就要选中这个模型
+	            var model = e.toPano.pano.pointcloud;
+	            if (model != lastModel) {
+	              this.changeModelMat(model, true); //目标模型
+	            }
+	          });
+	          this.addEventListener('flyToPanoDone', e => {
+	            //漫游到另一个模型就要选中这个模型
+	            var model = this.currentPano.pointcloud;
+	            if (model != lastModel) {
+	              this.changeModelMat(lastModel);
+	            }
+	            lastModel = model;
+	          });
+	        }
 	      }
 	    }
 	    if (Potree.settings.testCube) {
@@ -30754,14 +30823,28 @@
 	      }
 	    });
 	  }
-	  judgeModelMat(object) {
+	  changeModelMat(model, isCurModel) {
+	    if (model !== null && model !== void 0 && model.is4dkkModel) {
+	      if (model.fileType == '3dTiles') {
+	        viewer.setAllTilesets(model, child => {
+	          child.runtime.limit2lowestDepth(Potree.settings.displayMode == 'showPanos');
+	          child.runtime.getTileset().tiles.forEach(e => {
+	            this.judgeModelMat(e.tileContent, isCurModel);
+	          });
+	        });
+	      } else {
+	        this.judgeModelMat(model, isCurModel);
+	      }
+	    }
+	  }
+	  judgeModelMat(object, isCurModel) {
 	    if (!(Potree.settings.mergeType2 && Potree.settings.modelSkybox)) return;
 	    object.traverse(mesh => {
 	      if (mesh.material) {
 	        if (!mesh.materialOutside) {
 	          mesh.materialOutside = mesh.material;
 	        }
-	        mesh.material = Potree.settings.displayMode == 'showPanos' ? this.materialInside : mesh.materialOutside;
+	        mesh.material = Potree.settings.displayMode == 'showPanos' && (this.currentPano.pointcloud == object || isCurModel) ? this.materialInside : mesh.materialOutside;
 	        Potree.Utils.setObjectLayers(mesh, Potree.settings.displayMode == 'showPanos' ? 'skybox' : 'model'); //为了渲染到rtEDL
 	      }
 	    });
@@ -32072,7 +32155,7 @@
 	      var level = currentLevel * (1 - progress) + aimLevel * progress;
 	      this.zoomTo(level, !0);
 	    };
-	    transitions.start(fun, dur, null, null, 0, easing['easeInOutQuad']);
+	    transitions$1.start(fun, dur, null, null, 0, easing['easeInOutQuad']);
 	  }
 	  updateZoomPano() {
 	    if (!this.panoRenderer.zoomPanoRenderingDisabled && Potree.settings.displayMode == 'showPanos') {
@@ -75339,11 +75422,12 @@
 	  };
 
 	  // Set current object
-	  this.attach = function (object) {
+	  this.attach = function (object, clickPos) {
 	    this.object = object;
 	    Potree.Utils.updateVisible(this, 'attach', true);
 	    //Config.keyCon = false;//add
 	    //this.linesAssistance.setVisible(true)
+	    this.clickPos = clickPos !== null && clickPos !== void 0 && clickPos.isVector3 ? clickPos : null;
 	    viewer.dispatchEvent('content_changed');
 	    return this;
 	  };
@@ -75404,9 +75488,11 @@
 	      this.object.updateMatrixWorld();
 	      this.object.parent.matrixWorld.decompose(parentPosition, parentQuaternion, parentScale);
 	      this.object.matrixWorld.decompose(worldPosition, worldQuaternion, worldScale);
-
-	      //add
-	      if (this.object.boundingBox) {
+	      if (Potree.settings.mergeTransCtlOnClick && this.mode == 'translate' && this.clickPos) {
+	        //允许位移控件出现在点击的位置
+	        var pos = this.clickPos.clone().applyMatrix4(this.object.matrixWorld);
+	        worldPosition.copy(pos);
+	      } else if (this.object.boundingBox) {
 	        var boundingBox = this.object.boundingBox.clone().applyMatrix4(this.object.matrixWorld);
 	        boundingBox.getCenter(worldPosition); //bound中心
 	        if (this.pivotOnBottom) {
@@ -76734,7 +76820,12 @@
 	        var object = e.intersect.object || e.intersect.pointcloud;
 	        var objects = this.getAllObjects();
 	        if (objects.includes(object) && this.selected != object) {
-	          this.selectModel(object);
+	          var posInModel = Potree.Utils.datasetPosTransform({
+	            toDataset: true,
+	            position: e.intersect.location.clone(),
+	            object
+	          });
+	          this.selectModel(object, posInModel);
 	        } else {
 	          //if(!viewer.inputHandler.selection[0]){//正在平移和旋转,不允许取消
 	          this.selectModel(null);
@@ -77012,7 +77103,8 @@
 	    if (!by2d && model) {
 	      model.dispatchEvent({
 	        type: 'changeSelect',
-	        selected: state
+	        selected: state,
+	        clickPos: state
 	      });
 	    }
 	  },
@@ -79793,6 +79885,170 @@
 	  removeAnimation(animation) {
 	    animation.dispatchEvent('dispose');
 	    viewer.scene.removeCameraAnimation(animation);
+	  },
+	  createMulAnimation(data) {
+	    //新版,包含漫游点
+	    var event_ = new EventDispatcher();
+	    var sections = []; //分段
+	    var aniIndex = 0;
+	    var curAni,
+	      addAnimation = () => {
+	        if (curAni) {
+	          var data_ = {
+	            name: 'animation_' + aniIndex,
+	            duration: curAni.slice(0, curAni.length - 1).reduce(function (total, currentValue) {
+	              return total + currentValue.time;
+	            }, 0),
+	            //总时长(要去掉最后一个,因为已到终点,该点time无意义)
+	            useDurSlice: data.useDurSlice,
+	            points: curAni
+	          };
+	          var ani = createAnimation(data_);
+	          sections.push(ani);
+	          ani.originIndexStart = data.indexOf(curAni[0]);
+	          ani.addEventListener('updateCurrentIndex', e => {
+	            emitIndex(e.currentIndex);
+	          });
+	          curAni = null;
+	        }
+	      };
+	    data.points.forEach((e, i) => {
+	      //切分为若干个animation,中间是漫游点的衔接
+	      if (e.inPano) {
+	        var pano = e.model.panos.find(a => a.originID == e.panoId);
+	        if (pano) {
+	          addAnimation(); //如果前面是动画,先截断  
+	          e.pano = pano;
+	          e.quaternion = Potree.Utils.datasetRotTransform({
+	            fromDataset: true,
+	            quaternion: e.rotInModel,
+	            getQuaternion: true,
+	            model: e.model
+	          });
+	          sections.push(e);
+	        }
+	      } else {
+	        if (curAni) {
+	          curAni.push(e);
+	        } else {
+	          //非pano
+	          if (sections.length > 0) {
+	            var last = sections[sections.length - 1]; //因为要从上一个pano出来,所以起始点是上一个pano
+	            last.position = last.pano.position;
+	            last.target = last.position.clone().add(new Vector3(0, 0, -1).applyQuaternion(last.quaternion));
+	            curAni = [last, e];
+	          } else {
+	            curAni = [e];
+	          }
+	        }
+	      }
+	    });
+	    addAnimation();
+	    var currentPlay;
+	    var emitIndex = function emitIndex() {
+	      var indexInAni = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+	      var ani = sections[currentPlay];
+	      var currentIndex = 0;
+	      if (ani instanceof CameraAnimation$1) {
+	        currentIndex = ani.originIndexStart + indexInAni;
+	      } else {
+	        currentIndex = data.indexOf(ani);
+	      }
+	      event_.dispatchEvent({
+	        type: 'updateCurrentIndex',
+	        currentIndex
+	      });
+	    };
+	    var result = {
+	      event_,
+	      play() {
+	        //从头播放 
+
+	        var playNext = index => {
+	          if (index == sections.length) {
+	            return event_.dispatchEvent('playDone');
+	          }
+	          var ani = sections[index];
+	          currentPlay = index;
+	          emitIndex();
+	          if (ani instanceof CameraAnimation$1) {
+	            Potree.settings.displayMode = 'showPointCloud';
+	            ani.addEventListener('playDone', () => {
+	              playNext(index + 1);
+	            }, {
+	              once: true
+	            });
+	            ani.play();
+	          } else {
+	            var last = sections[index - 1],
+	              duration,
+	              quaternion = ani.quaternion;
+	            if (last) {
+	              var pano = ani.pano;
+	              if (last instanceof CameraAnimation$1) {
+	                duration = last.durations[last.durations.length - 1]; //最后一个时间
+	              } else {
+	                duration = last.time;
+	              }
+	              duration *= 1000;
+	              viewer.images360.flyToPano({
+	                pano,
+	                quaternion,
+	                duration,
+	                callback: () => {
+	                  if (ani.displayMode == 'showPanos' && potree.settings.displayMode != 'showPanos') {
+	                    //刚加载完就飞走吗?
+	                    potree.settings.displayMode = 'showPanos';
+	                    viewer.images360.addEventListener('endChangeMode', () => {
+	                      currentPlay != void 0 && playNext(index + 1);
+	                    }, {
+	                      once: true
+	                    });
+	                  } else {
+	                    currentPlay != void 0 && playNext(index + 1);
+	                  }
+	                }
+	              });
+	            }
+	          }
+	        };
+	        playNext(0);
+	      },
+	      stop() {
+	        var ani = sections[currentPlay];
+	        if (ani instanceof CameraAnimation$1) {
+	          ani.pause();
+	        } else {
+	          var view = viewer.mainViewport.view;
+	          if (!view.isFlying('pos')) {
+	            //前后是相同漫游点,仅旋转
+	            view.cancelFlying('rotate');
+	          } else {
+	            //加快结束
+	            var o = transitions.getById(view.FlyTransition);
+	            var restDur = o.duration - o.current;
+	            var hopeStopTime = 300; //希望最多等待时间
+	            if (restDur > hopeStopTime) {
+	              var r = o.duration / (o.current + hopeStopTime);
+	              transitions.adjustSpeed(view.FlyTransition, r);
+	              transitions.adjustSpeed(view.LookTransition, r);
+	            }
+	          }
+	          //如果有地图,还要改地图的view
+	        }
+	        currentPlay = null;
+	      },
+	      remove() {
+	        sections.forEach(ani => {
+	          if (ani instanceof CameraAnimation$1) {
+	            this.removeAnimation(ani);
+	          }
+	        });
+	      }
+
+	      //再把中间的缓动去除
+	    };
+	    return result;
 	  }
 	};
 
@@ -82831,7 +83087,7 @@
 	    var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
 	    if (this.hidden) return;
 	    this.hidden = !0;
-	    transitions.start(lerp.property(this.material, "opacity", 0, () => {
+	    transitions$1.start(lerp.property(this.material, "opacity", 0, () => {
 	      //progress
 	      this.dispatchEvent({
 	        type: 'update'
@@ -82856,7 +83112,7 @@
 	    //console.log("show Reticule")
 	    this.hidden = !1;
 	    if (this.material.opacity <= 0) {
-	      transitions.start(lerp.property(this.material, "opacity", defaultOpacity, () => {
+	      transitions$1.start(lerp.property(this.material, "opacity", defaultOpacity, () => {
 	        //progress
 	        this.dispatchEvent({
 	          type: 'update'
@@ -88702,7 +88958,7 @@
 	  update(delta, timestamp) {
 	    viewer.addTimeMark('update', 'start');
 	    TWEEN.update(timestamp);
-	    transitions.update(delta); //写在开头,因为这时候最为固定,计时准确
+	    transitions$1.update(delta); //写在开头,因为这时候最为固定,计时准确
 
 	    this.dispatchEvent({
 	      type: 'update_start',
@@ -91498,11 +91754,11 @@
 	                this.addEventListener('global_mousedown', startPlay);
 	              }
 	              Potree.settings.zoom.enabled = false;
-	              transitions.start(lerp.property(plane.material, "opacity", 1), e.toPano.duration * 0.4, () => {}, 0, easing['easeInOutQuad']);
+	              transitions$1.start(lerp.property(plane.material, "opacity", 1), e.toPano.duration * 0.4, () => {}, 0, easing['easeInOutQuad']);
 	            }, e.toPano.duration * 0.6); //时间上不能和消失的重叠 延迟 
 	          } else {
 	            //消失
-	            transitions.start(lerp.property(plane.material, "opacity", 0), e.toPano.duration * 0.4, () => {
+	            transitions$1.start(lerp.property(plane.material, "opacity", 0), e.toPano.duration * 0.4, () => {
 	              if (!info) {
 	                plane.visible = false;
 	                video.pause();

File diff suppressed because it is too large
+ 1 - 1
public/lib/potree/potree.js.map


+ 8 - 24
public/test-case/model-list-demo.json

@@ -194,15 +194,11 @@
                     100.0,
                     100.0
                 ],
-                "position": {
-                    "x": 20.092762021549753,
-                    "y": -115.72516108460032,
-                    "z": -1.8091536
-                },
+                "position": {"x": 21.718078050324927, "y": -116.62798835721699, "z": -2.004813867380852},
                 "rotation": {
                     "x": 0.0,
                     "y": 0.0,
-                    "z": -0.435149718040960
+                    "z": -0.4000990367565785
                 }
             },
             "opacity": 100.0,
@@ -255,15 +251,11 @@
                     100.0,
                     100.0
                 ],
-                "position": {
-                    "x": -3.94976,
-                    "y": -20.06918,
-                    "z": 2.19647
-                },
+                "position": {"x": 87.75751449768335, "y": -120.36286009836489, "z": 1.4672641534166577},
                 "rotation": {
                     "x": 0.0,
                     "y": 0.0,
-                    "z": -1.5953
+                    "z": -0.395517181031977
                 }
             },
             "opacity": 100.0,
@@ -314,15 +306,11 @@
                     100.0,
                     100.0
                 ],
-                "position": {
-                    "x": 0.0,
-                    "y": 0.0,
-                    "z": 0.0
-                },
+                "position": {"x":66.52315710699722, "y": -110.45068505837203, "z": 1.3805386895251424},
                 "rotation": {
                     "x": 0.0,
                     "y": 0.0,
-                    "z": 0.0
+                    "z": 1.1630612485179241
                 }
             },
             "opacity": 100.0,
@@ -373,15 +361,11 @@
                     100.0,
                     100.0
                 ],
-                "position": {
-                    "x": 9.07272,
-                    "y": -23.60383,
-                    "z": 1.9989
-                },
+                "position": {"x": 95.77650916161897, "y": -110.19314554875757, "z": 1.2033768049697668},
                 "rotation": {
                     "x": 0.0,
                     "y": 0.0,
-                    "z": 1.56016
+                    "z": 2.7123698466041453
                 }
             },
             "opacity": 100.0,

+ 5 - 3
src/sdk/cover/index.js

@@ -30,11 +30,13 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
     Potree.settings.mergeType2 = true //标识新版
     Potree.settings.modelSkybox = true //是否将全景图贴在模型上(会导致卡顿)。若不显示模型将不显示Reticule
     Potree.settings.tiles3DMaxMemory = 300 //稍微增加点
-
+    Potree.settings.mergeTransCtlOnClick = true
+    Potree.settings.canWalkThroughModel = true
+    
     let { THREE } = Potree.mergeEditStart(dom, mapDom)
     let MergeEditor = viewer.modules.MergeEditor
     Potree.settings.unableNavigate = false
-    Potree.settings.canWalkThroughModel = true
+    
     Potree.settings.showCesium = true
     if (Potree.settings.showCesium) {
 
@@ -736,7 +738,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
                 spliceFromArr(model, props, true)
  
                 model.addEventListener('changeSelect', (e) => {
-                    e.selected ? MergeEditor.transformControls.attach(model) : MergeEditor.transformControls.detach()
+                    e.selected ? MergeEditor.transformControls.attach(model, e.clickPos) : MergeEditor.transformControls.detach()
                 })