|
@@ -15,7 +15,7 @@ class ExtendView extends View {
|
|
|
|
|
|
this.sid = sid++
|
|
|
this.LookTransition = 'LookTransition'+this.sid
|
|
|
-
|
|
|
+ this.FlyTransition = 'FlyTransition'+this.sid
|
|
|
|
|
|
}
|
|
|
//add------
|
|
@@ -101,18 +101,24 @@ class ExtendView extends View {
|
|
|
|
|
|
|
|
|
this.position = this.position.add(t);
|
|
|
+
|
|
|
+
|
|
|
+ Potree.settings.displayMode != 'showPanos' && this.cancelFlying('pos')
|
|
|
+
|
|
|
this.restrictPos()
|
|
|
}
|
|
|
|
|
|
- translateWorld (x, y, z) {
|
|
|
+ translateWorld (x, y, z) {
|
|
|
super.translateWorld(x, y, z)
|
|
|
+
|
|
|
+ Potree.settings.displayMode != 'showPanos' && this.cancelFlying('pos')
|
|
|
this.restrictPos()
|
|
|
}
|
|
|
|
|
|
|
|
|
- restrictPos(){//add
|
|
|
+ restrictPos(position){//add
|
|
|
if(this.limitBound){
|
|
|
- this.position.clamp(this.limitBound.min, this.limitBound.max)
|
|
|
+ (position || this.position).clamp(this.limitBound.min, this.limitBound.max)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -150,14 +156,23 @@ class ExtendView extends View {
|
|
|
|
|
|
|
|
|
|
|
|
- isFlying(){
|
|
|
- return transitions.getById(this.LookTransition).length > 0
|
|
|
+ isFlying(type='all'){
|
|
|
+ let a = transitions.getById(this.FlyTransition).length > 0
|
|
|
+ let b = transitions.getById(this.LookTransition).length > 0
|
|
|
+
|
|
|
+ return type == 'pos' ? a : type == 'rotate' ? b : a && b
|
|
|
}
|
|
|
|
|
|
- cancelFlying(){//外界只能通过这个来cancel
|
|
|
- transitions.cancelById(this.LookTransition, true );
|
|
|
+ cancelFlying(type='all'){//外界只能通过这个来cancel
|
|
|
+ type == 'pos' ? transitions.cancelById(this.FlyTransition, true )
|
|
|
+ : type == 'rotate' ? transitions.cancelById(this.LookTransition, true )
|
|
|
+ : (transitions.cancelById(this.FlyTransition, true ), transitions.cancelById(this.LookTransition, true ))
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
setView( info = {}){
|
|
|
// position, target, duration = 0, callback = null, onUpdate = null, Easing='', cancelFun
|
|
|
this.cancelFlying()
|
|
@@ -185,7 +200,7 @@ class ExtendView extends View {
|
|
|
let endPosition = new THREE.Vector3().copy(info.position)
|
|
|
let startPosition = this.position.clone();
|
|
|
let startQuaternion, endQuaternion, endTarget = null ;
|
|
|
-
|
|
|
+ this.restrictPos(endPosition)
|
|
|
|
|
|
if(info.target ){
|
|
|
endTarget = new THREE.Vector3().copy(info.target)
|
|
@@ -210,8 +225,31 @@ class ExtendView extends View {
|
|
|
done()
|
|
|
|
|
|
}else{
|
|
|
-
|
|
|
- transitions.start(lerp.vector(this.position, endPosition, (pos, progress)=>{
|
|
|
+
|
|
|
+ if(!this.position.equals(endPosition)){
|
|
|
+ transitions.start(lerp.vector(this.position, endPosition, (pos, progress)=>{
|
|
|
+
|
|
|
+ info.onUpdate && info.onUpdate(t)
|
|
|
+
|
|
|
+ }), info.duration, done, 0, info.Easing ? easing[info.Easing] : easing.easeInOutSine /*easeInOutQuad */,null, this.FlyTransition, info.cancelFun);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ endQuaternion && transitions.start( (progress)=>{
|
|
|
+
|
|
|
+ let quaternion = (new THREE.Quaternion()).copy(startQuaternion)
|
|
|
+ lerp.quaternion(quaternion, endQuaternion)(progress),
|
|
|
+ this.rotation = new THREE.Euler().setFromQuaternion(quaternion)
|
|
|
+
|
|
|
+ posChange || info.onUpdate && info.onUpdate(t)
|
|
|
+
|
|
|
+ }, info.duration, posChange?done:null, 0, info.Easing ? easing[info.Easing] : easing.easeInOutSine ,null, this.LookTransition, info.cancelFun);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /* transitions.start(lerp.vector(this.position, endPosition, (pos, progress)=>{
|
|
|
let t = progress
|
|
|
|
|
|
if(endQuaternion){
|
|
@@ -223,8 +261,8 @@ class ExtendView extends View {
|
|
|
//console.log('setView flying')
|
|
|
|
|
|
info.onUpdate && info.onUpdate(t)//add
|
|
|
- }), info.duration, done, 0, info.Easing ? easing[info.Easing] : easing.easeInOutSine /*easeInOutQuad */,null, this.LookTransition, info.cancelFun);
|
|
|
-
|
|
|
+ }), info.duration, done, 0, info.Easing ? easing[info.Easing] : easing.easeInOutSine ,null, this.LookTransition, info.cancelFun); //easeInOutQuad
|
|
|
+ */
|
|
|
|
|
|
}
|
|
|
|