xzw 1 год назад
Родитель
Сommit
a36d65eb11
3 измененных файлов с 54 добавлено и 50 удалено
  1. 43 39
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 10 10
      src/sdk/cover/index.js

+ 43 - 39
public/lib/potree/potree.js

@@ -4239,7 +4239,7 @@
 
 	 */
 
-	var transitions$1 = {
+	var transitions = {
 	  globalDone: null,
 	  funcs: [],
 	  counter: 0,
@@ -5258,15 +5258,15 @@
 	  }
 	  isFlying() {
 	    var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all';
-	    var a = transitions$1.getById(this.FlyTransition).length > 0;
-	    var b = transitions$1.getById(this.LookTransition).length > 0;
+	    var a = transitions.getById(this.FlyTransition).length > 0;
+	    var b = transitions.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$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));
+	    type == 'pos' ? transitions.cancelById(this.FlyTransition, dealCancel) : type == 'rotate' ? transitions.cancelById(this.LookTransition, dealCancel) : (transitions.cancelById(this.FlyTransition, dealCancel), transitions.cancelById(this.LookTransition, dealCancel));
 	    //console.log('cancelFlying ' , this.sid,  type)
 	  }
 	  setView() {
@@ -5357,7 +5357,7 @@
 	      var posChange = !this.position.equals(endPosition);
 	      if (posChange) {
 	        posWaitDone = true;
-	        transitions$1.start(lerp.vector(this.position, endPosition, (pos, progress, delta) => {
+	        transitions.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, () => {
 	          //中途取消 
@@ -5375,7 +5375,7 @@
 	      }
 	      if (endQuaternion || endYaw != void 0) {
 	        rotWaitDone = true;
-	        transitions$1.start((progress, delta) => {
+	        transitions.start((progress, delta) => {
 	          if (endYaw != void 0) {
 	            this.yaw = startYaw * (1 - progress) + endYaw * progress;
 	            this.pitch = startPitch * (1 - progress) + endPitch * progress;
@@ -5469,7 +5469,7 @@
 
 	    var startZoom = camera.zoom;
 	    var pointerPos = new Vector3(pointer.x, pointer.y, 0.5);
-	    transitions$1.start(progress => {
+	    transitions.start(progress => {
 	      var oldPos = pointerPos.clone().unproject(camera);
 	      this.zoom = camera.zoom = endZoom * progress + startZoom * (1 - progress);
 	      camera.updateProjectionMatrix();
@@ -27075,7 +27075,7 @@
 	  hoverOn() {
 	    var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 	    //console.log("hoverOn  " + this.id  ) 
-	    transitions$1.start(lerp.property(this.marker.material, "opacity", markerOpacitys.hovered, () => {
+	    transitions.start(lerp.property(this.marker.material, "opacity", markerOpacitys.hovered, () => {
 	      viewer.dispatchEvent('content_changed');
 	    }), this.marker.visible ? 250 : 0);
 	    if (!e.byMap) this.dispatchEvent({
@@ -27091,7 +27091,7 @@
 	  hoverOff() {
 	    var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 	    //console.log("hoverOff  " + this.id  )
-	    transitions$1.start(lerp.property(this.marker.material, "opacity", markerOpacitys.default, () => {
+	    transitions.start(lerp.property(this.marker.material, "opacity", markerOpacitys.default, () => {
 	      viewer.dispatchEvent('content_changed');
 	    }), this.marker.visible ? 250 : 0);
 	    if (!e.byMap) this.dispatchEvent({
@@ -32163,7 +32163,7 @@
 	      var level = currentLevel * (1 - progress) + aimLevel * progress;
 	      this.zoomTo(level, !0);
 	    };
-	    transitions$1.start(fun, dur, null, null, 0, easing['easeInOutQuad']);
+	    transitions.start(fun, dur, null, null, 0, easing['easeInOutQuad']);
 	  }
 	  updateZoomPano() {
 	    if (!this.panoRenderer.zoomPanoRenderingDisabled && Potree.settings.displayMode == 'showPanos') {
@@ -79916,9 +79916,9 @@
 	            useDurSlice: data.useDurSlice,
 	            points: curAni
 	          };
-	          var ani = createAnimation(data_);
+	          var ani = this.createAnimation(data_);
 	          sections.push(ani);
-	          ani.originIndexStart = data.indexOf(curAni[0]);
+	          ani.originIndexStart = data.points.indexOf(curAni[0]);
 	          ani.addEventListener('updateCurrentIndex', e => {
 	            emitIndex(e.currentIndex);
 	          });
@@ -79927,11 +79927,13 @@
 	      };
 	    data.points.forEach((e, i) => {
 	      //切分为若干个animation,中间是漫游点的衔接
-	      if (e.inPano) {
+	      if (e.panoId != void 0) {
+	        //暂定,有panoId的都是全景图模式
 	        var pano = e.model.panos.find(a => a.originID == e.panoId);
 	        if (pano) {
 	          addAnimation(); //如果前面是动画,先截断  
 	          e.pano = pano;
+	          e.rotInModel = new Quaternion().fromArray(e.rotInModel);
 	          e.quaternion = Potree.Utils.datasetRotTransform({
 	            fromDataset: true,
 	            quaternion: e.rotInModel,
@@ -79965,7 +79967,7 @@
 	      if (ani instanceof CameraAnimation$1) {
 	        currentIndex = ani.originIndexStart + indexInAni;
 	      } else {
-	        currentIndex = data.indexOf(ani);
+	        currentIndex = Math.max(0, data.points.indexOf(ani) - 1);
 	      }
 	      event_.dispatchEvent({
 	        type: 'updateCurrentIndex',
@@ -79993,36 +79995,38 @@
 	            });
 	            ani.play();
 	          } else {
+	            var pano = ani.pano;
 	            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 {
+	            } else {
+	              duration = 600; //起始
+	            }
+	            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);
@@ -80038,7 +80042,7 @@
 	            view.cancelFlying('rotate');
 	          } else {
 	            //加快结束
-	            var o = transitions.getById(view.FlyTransition);
+	            var o = transitions.getById(view.FlyTransition)[0];
 	            var restDur = o.duration - o.current;
 	            var hopeStopTime = 300; //希望最多等待时间
 	            if (restDur > hopeStopTime) {
@@ -80054,7 +80058,7 @@
 	      remove() {
 	        sections.forEach(ani => {
 	          if (ani instanceof CameraAnimation$1) {
-	            this.removeAnimation(ani);
+	            CamAniEditor.removeAnimation(ani);
 	          }
 	        });
 	      }
@@ -83100,7 +83104,7 @@
 	    var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
 	    if (this.hidden) return;
 	    this.hidden = !0;
-	    transitions$1.start(lerp.property(this.material, "opacity", 0, () => {
+	    transitions.start(lerp.property(this.material, "opacity", 0, () => {
 	      //progress
 	      this.dispatchEvent({
 	        type: 'update'
@@ -83125,7 +83129,7 @@
 	    //console.log("show Reticule")
 	    this.hidden = !1;
 	    if (this.material.opacity <= 0) {
-	      transitions$1.start(lerp.property(this.material, "opacity", defaultOpacity, () => {
+	      transitions.start(lerp.property(this.material, "opacity", defaultOpacity, () => {
 	        //progress
 	        this.dispatchEvent({
 	          type: 'update'
@@ -88971,7 +88975,7 @@
 	  update(delta, timestamp) {
 	    viewer.addTimeMark('update', 'start');
 	    TWEEN.update(timestamp);
-	    transitions$1.update(delta); //写在开头,因为这时候最为固定,计时准确
+	    transitions.update(delta); //写在开头,因为这时候最为固定,计时准确
 
 	    this.dispatchEvent({
 	      type: 'update_start',
@@ -91767,11 +91771,11 @@
 	                this.addEventListener('global_mousedown', startPlay);
 	              }
 	              Potree.settings.zoom.enabled = false;
-	              transitions$1.start(lerp.property(plane.material, "opacity", 1), e.toPano.duration * 0.4, () => {}, 0, easing['easeInOutQuad']);
+	              transitions.start(lerp.property(plane.material, "opacity", 1), e.toPano.duration * 0.4, () => {}, 0, easing['easeInOutQuad']);
 	            }, e.toPano.duration * 0.6); //时间上不能和消失的重叠 延迟 
 	          } else {
 	            //消失
-	            transitions$1.start(lerp.property(plane.material, "opacity", 0), e.toPano.duration * 0.4, () => {
+	            transitions.start(lerp.property(plane.material, "opacity", 0), e.toPano.duration * 0.4, () => {
 	              if (!info) {
 	                plane.visible = false;
 	                video.pause();

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
public/lib/potree/potree.js.map


+ 10 - 10
src/sdk/cover/index.js

@@ -511,7 +511,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
                     o.rotInModel = new THREE.Quaternion().fromArray(o.rotInModel)
                     let quaternion = Potree.Utils.datasetRotTransform({ fromDataset: true, quaternion: o.rotInModel, getQuaternion: true, object:model})  
 
-                    o.model.flyInPano(pano, {quaternion, callback(){
+                    o.model.flyInPano(pano, {quaternion, duration:0, callback(){
                         o.callback && o.callback()
                         deferred.resolve(true)
                     }})
@@ -607,7 +607,11 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
           
 
             //console.log('enterSceneGuide',pathArr)
-
+            pathArr.forEach(e=>{
+                if(e.panoId != void 0){
+                    e.model = e.model.model
+                }
+            })
             let data = {
                 //duration: pathArr.slice(0, pathArr.length - 1).reduce(function (total, currentValue) { return total + currentValue.time }, 0), //总时长(要去掉最后一个,因为已到终点,该点time无意义)
                 points: pathArr,
@@ -615,11 +619,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
             }
             
             
-            data.pathArr.forEach(e=>{
-                if(e.inPano){
-                    e.model = e.model.model
-                }
-            })
+            
             let ani = editor.createMulAnimation(data)
              
              
@@ -645,7 +645,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
                     ani.play()
                 },
                 pause() {
-                    ani.pause()
+                    ani.stop()
                 },
 
                 clear() { 
@@ -815,7 +815,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
                 supportPano() {  //是否支持全景图
                     return model.panos && model.panos.length > 0
                 },
-                flyInPano(pano, {dontFly, quaternion}={}) {//  飞入全景图
+                flyInPano(pano, {dontFly, quaternion, duration}={}) {//  飞入全景图
                     requestInPano = model
                     pano = pano || viewer.images360.findNearestPano(null, model.panos)
                     if (pano) {
@@ -841,7 +841,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
                             }
                         }, { once: true })
 
-                        dontFly || viewer.images360.flyToPano({ pano, canCancelLast: true, quaternion })
+                        dontFly || viewer.images360.flyToPano({ pano, canCancelLast: true, quaternion, duration})
                         Potree.settings.displayMode = 'showPanos'