|
@@ -101,9 +101,8 @@ class ExtendView extends View {
|
|
|
|
|
|
|
|
|
this.position = this.position.add(t);
|
|
|
-
|
|
|
-
|
|
|
- Potree.settings.displayMode != 'showPanos' && this.cancelFlying('pos')
|
|
|
+
|
|
|
+ x != 0 && y != 0 && z != 0 && /* t.lengthSq()!=0 && */Potree.settings.displayMode != 'showPanos' && this.cancelFlying('pos')
|
|
|
|
|
|
this.restrictPos()
|
|
|
}
|
|
@@ -111,7 +110,7 @@ class ExtendView extends View {
|
|
|
translateWorld (x, y, z) {
|
|
|
super.translateWorld(x, y, z)
|
|
|
|
|
|
- Potree.settings.displayMode != 'showPanos' && this.cancelFlying('pos')
|
|
|
+ x != 0 && y != 0 && z != 0 && Potree.settings.displayMode != 'showPanos' && this.cancelFlying('pos')
|
|
|
this.restrictPos()
|
|
|
}
|
|
|
|
|
@@ -176,25 +175,30 @@ class ExtendView extends View {
|
|
|
setView( info = {}){
|
|
|
// position, target, duration = 0, callback = null, onUpdate = null, Easing='', cancelFun
|
|
|
this.cancelFlying()
|
|
|
-
|
|
|
- let done = ()=>{
|
|
|
+ let finished
|
|
|
+ let posDone = ()=>{
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ let rotDone = ()=>{
|
|
|
if(endTarget){
|
|
|
this.lookAt(endTarget); //compute radius for orbitcontrol
|
|
|
}else if(endQuaternion){
|
|
|
this.rotation = new THREE.Euler().setFromQuaternion(endQuaternion)
|
|
|
}
|
|
|
-
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ let done = ()=>{
|
|
|
+ if(finished)return
|
|
|
let f = ()=>{
|
|
|
info.callback && info.callback()
|
|
|
- this.dispatchEvent('flyingDone')
|
|
|
+ this.dispatchEvent('flyingDone')
|
|
|
}
|
|
|
if(info.duration){
|
|
|
setTimeout(f,1)//延迟是为了使isFlying先为false
|
|
|
}else{
|
|
|
f() //有的需要迅速执行回调
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ finished = true
|
|
|
}
|
|
|
|
|
|
let endPosition = new THREE.Vector3().copy(info.position)
|
|
@@ -222,16 +226,16 @@ class ExtendView extends View {
|
|
|
this.restrictPos()
|
|
|
|
|
|
info.onUpdate && info.onUpdate(1)
|
|
|
- done()
|
|
|
-
|
|
|
+ posDone()
|
|
|
+ rotDone()
|
|
|
}else{
|
|
|
-
|
|
|
- if(!this.position.equals(endPosition)){
|
|
|
+ let posChange = !this.position.equals(endPosition)
|
|
|
+ if(posChange){
|
|
|
transitions.start(lerp.vector(this.position, endPosition, (pos, progress)=>{
|
|
|
|
|
|
- info.onUpdate && info.onUpdate(t)
|
|
|
+ info.onUpdate && info.onUpdate(progress)
|
|
|
|
|
|
- }), info.duration, done, 0, info.Easing ? easing[info.Easing] : easing.easeInOutSine /*easeInOutQuad */,null, this.FlyTransition, info.cancelFun);
|
|
|
+ }), info.duration, posDone/* done */, 0, info.Easing ? easing[info.Easing] : easing.easeInOutSine /*easeInOutQuad */,null, this.FlyTransition, info.cancelFun);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -242,9 +246,9 @@ class ExtendView extends View {
|
|
|
lerp.quaternion(quaternion, endQuaternion)(progress),
|
|
|
this.rotation = new THREE.Euler().setFromQuaternion(quaternion)
|
|
|
|
|
|
- posChange || info.onUpdate && info.onUpdate(t)
|
|
|
+ posChange || info.onUpdate && info.onUpdate(progress)
|
|
|
|
|
|
- }, info.duration, posChange?done:null, 0, info.Easing ? easing[info.Easing] : easing.easeInOutSine ,null, this.LookTransition, info.cancelFun);
|
|
|
+ }, info.duration, rotDone/* posChange?done:null */, 0, info.Easing ? easing[info.Easing] : easing.easeInOutSine ,null, this.LookTransition, info.cancelFun);
|
|
|
|
|
|
|
|
|
|