xzw 2 years ago
parent
commit
24ca0a3705
2 changed files with 16 additions and 3 deletions
  1. 3 3
      src/custom/modules/CameraAnimation/CameraAnimation.js
  2. 13 0
      src/custom/utils/Common.js

+ 3 - 3
src/custom/modules/CameraAnimation/CameraAnimation.js

@@ -173,7 +173,7 @@ export class CameraAnimation extends THREE.EventDispatcher{
                  
             }else if(length >= 2){ 
                 position.copy(this.posCurve.points[index-1].clone().add(this.posCurve.points[index]).multiplyScalar(0.5));
-                target.copy(this.targets[index-1].position.clone().add(this.targets[index]).multiplyScalar(0.5));
+                target.copy(this.targets[index-1].position.clone().add(this.targets[index].position).multiplyScalar(0.5));
             }
         }else{
             position.copy(posInfo.position)
@@ -217,8 +217,8 @@ export class CameraAnimation extends THREE.EventDispatcher{
             index = this.targets.indexOf(e.target)
         }
         LineDraw.moveLine(this.targetLines.children[index], [this.posCurve.points[index], this.targets[index].position] )
-         
-        this.updateFrustum()
+        viewer.dispatchEvent('content_changed')
+        this.updateFrustum() 
     } 
      
     updatePathCallback(){

+ 13 - 0
src/custom/utils/Common.js

@@ -445,6 +445,19 @@ var Common = {
         
     },
     
+    watch: function(object, propName, initialValue){ //监听某个属性的变化
+        let v = initialValue
+        Object.defineProperty(object, propName, {
+            get: function() {
+                return v
+            },
+            set: function(e) {
+                 console.warn('watch:',propName, e)
+                 v = e 
+            }
+        }) 
+    },
+      
     
 }