|
@@ -67,6 +67,7 @@ var config, |
|
|
externalEventListeners = {}, |
|
|
externalEventListeners = {}, |
|
|
specifiedPhotoSphereExcludes = [], |
|
|
specifiedPhotoSphereExcludes = [], |
|
|
update = false, // Should we update when still to render dynamic content |
|
|
update = false, // Should we update when still to render dynamic content |
|
|
|
|
|
eps = 1e-6, |
|
|
hotspotsCreated = false; |
|
|
hotspotsCreated = false; |
|
|
|
|
|
|
|
|
var defaultConfig = { |
|
|
var defaultConfig = { |
|
@@ -1301,11 +1302,7 @@ function animateMove(axis) { |
|
|
t.endPosition === t.startPosition) { |
|
|
t.endPosition === t.startPosition) { |
|
|
result = t.endPosition; |
|
|
result = t.endPosition; |
|
|
speed[axis] = 0; |
|
|
speed[axis] = 0; |
|
|
var callback = animatedMove[axis].callback, |
|
|
|
|
|
callbackArgs = animatedMove[axis].callbackArgs; |
|
|
|
|
|
delete animatedMove[axis]; |
|
|
delete animatedMove[axis]; |
|
|
if (typeof callback == 'function') |
|
|
|
|
|
callback(callbackArgs); |
|
|
|
|
|
} |
|
|
} |
|
|
config[axis] = result; |
|
|
config[axis] = result; |
|
|
} |
|
|
} |
|
@@ -2388,20 +2385,25 @@ this.getPitch = function() { |
|
|
* @returns {Viewer} `this` |
|
|
* @returns {Viewer} `this` |
|
|
*/ |
|
|
*/ |
|
|
this.setPitch = function(pitch, animated, callback, callbackArgs) { |
|
|
this.setPitch = function(pitch, animated, callback, callbackArgs) { |
|
|
|
|
|
latestInteraction = Date.now(); |
|
|
|
|
|
if (Math.abs(pitch - config.pitch) <= eps) { |
|
|
|
|
|
if (typeof callback == 'function') |
|
|
|
|
|
callback(callbackArgs); |
|
|
|
|
|
return this; |
|
|
|
|
|
} |
|
|
animated = animated == undefined ? 1000: Number(animated); |
|
|
animated = animated == undefined ? 1000: Number(animated); |
|
|
if (animated) { |
|
|
if (animated) { |
|
|
animatedMove.pitch = { |
|
|
animatedMove.pitch = { |
|
|
'startTime': Date.now(), |
|
|
'startTime': Date.now(), |
|
|
'startPosition': config.pitch, |
|
|
'startPosition': config.pitch, |
|
|
'endPosition': pitch, |
|
|
'endPosition': pitch, |
|
|
'duration': animated, |
|
|
|
|
|
'callback': callback, |
|
|
|
|
|
'callbackArgs': callbackArgs |
|
|
|
|
|
|
|
|
'duration': animated |
|
|
} |
|
|
} |
|
|
|
|
|
if (typeof callback == 'function') |
|
|
|
|
|
setTimeout(function(){callback(callbackArgs)}, animated); |
|
|
} else { |
|
|
} else { |
|
|
config.pitch = pitch; |
|
|
config.pitch = pitch; |
|
|
} |
|
|
} |
|
|
latestInteraction = Date.now(); |
|
|
|
|
|
animateInit(); |
|
|
animateInit(); |
|
|
return this; |
|
|
return this; |
|
|
}; |
|
|
}; |
|
@@ -2450,6 +2452,12 @@ this.getYaw = function() { |
|
|
* @returns {Viewer} `this` |
|
|
* @returns {Viewer} `this` |
|
|
*/ |
|
|
*/ |
|
|
this.setYaw = function(yaw, animated, callback, callbackArgs) { |
|
|
this.setYaw = function(yaw, animated, callback, callbackArgs) { |
|
|
|
|
|
latestInteraction = Date.now(); |
|
|
|
|
|
if (Math.abs(yaw - config.yaw) <= eps) { |
|
|
|
|
|
if (typeof callback == 'function') |
|
|
|
|
|
callback(callbackArgs); |
|
|
|
|
|
return this; |
|
|
|
|
|
} |
|
|
animated = animated == undefined ? 1000: Number(animated); |
|
|
animated = animated == undefined ? 1000: Number(animated); |
|
|
yaw = ((yaw + 180) % 360) - 180 // Keep in bounds |
|
|
yaw = ((yaw + 180) % 360) - 180 // Keep in bounds |
|
|
if (animated) { |
|
|
if (animated) { |
|
@@ -2463,14 +2471,13 @@ this.setYaw = function(yaw, animated, callback, callbackArgs) { |
|
|
'startTime': Date.now(), |
|
|
'startTime': Date.now(), |
|
|
'startPosition': config.yaw, |
|
|
'startPosition': config.yaw, |
|
|
'endPosition': yaw, |
|
|
'endPosition': yaw, |
|
|
'duration': animated, |
|
|
|
|
|
'callback': callback, |
|
|
|
|
|
'callbackArgs': callbackArgs |
|
|
|
|
|
|
|
|
'duration': animated |
|
|
} |
|
|
} |
|
|
|
|
|
if (typeof callback == 'function') |
|
|
|
|
|
setTimeout(function(){callback(callbackArgs)}, animated); |
|
|
} else { |
|
|
} else { |
|
|
config.yaw = yaw; |
|
|
config.yaw = yaw; |
|
|
} |
|
|
} |
|
|
latestInteraction = Date.now(); |
|
|
|
|
|
animateInit(); |
|
|
animateInit(); |
|
|
return this; |
|
|
return this; |
|
|
}; |
|
|
}; |
|
@@ -2519,20 +2526,25 @@ this.getHfov = function() { |
|
|
* @returns {Viewer} `this` |
|
|
* @returns {Viewer} `this` |
|
|
*/ |
|
|
*/ |
|
|
this.setHfov = function(hfov, animated, callback, callbackArgs) { |
|
|
this.setHfov = function(hfov, animated, callback, callbackArgs) { |
|
|
|
|
|
latestInteraction = Date.now(); |
|
|
|
|
|
if (Math.abs(hfov - config.hfov) <= eps) { |
|
|
|
|
|
if (typeof callback == 'function') |
|
|
|
|
|
callback(callbackArgs); |
|
|
|
|
|
return this; |
|
|
|
|
|
} |
|
|
animated = animated == undefined ? 1000: Number(animated); |
|
|
animated = animated == undefined ? 1000: Number(animated); |
|
|
if (animated) { |
|
|
if (animated) { |
|
|
animatedMove.hfov = { |
|
|
animatedMove.hfov = { |
|
|
'startTime': Date.now(), |
|
|
'startTime': Date.now(), |
|
|
'startPosition': config.hfov, |
|
|
'startPosition': config.hfov, |
|
|
'endPosition': constrainHfov(hfov), |
|
|
'endPosition': constrainHfov(hfov), |
|
|
'duration': animated, |
|
|
|
|
|
'callback': callback, |
|
|
|
|
|
'callbackArgs': callbackArgs |
|
|
|
|
|
|
|
|
'duration': animated |
|
|
} |
|
|
} |
|
|
|
|
|
if (typeof callback == 'function') |
|
|
|
|
|
setTimeout(function(){callback(callbackArgs)}, animated); |
|
|
} else { |
|
|
} else { |
|
|
setHfov(hfov); |
|
|
setHfov(hfov); |
|
|
} |
|
|
} |
|
|
latestInteraction = Date.now(); |
|
|
|
|
|
animateInit(); |
|
|
animateInit(); |
|
|
return this; |
|
|
return this; |
|
|
}; |
|
|
}; |
|
@@ -2575,16 +2587,20 @@ this.setHfovBounds = function(bounds) { |
|
|
*/ |
|
|
*/ |
|
|
this.lookAt = function(pitch, yaw, hfov, animated, callback, callbackArgs) { |
|
|
this.lookAt = function(pitch, yaw, hfov, animated, callback, callbackArgs) { |
|
|
animated = animated == undefined ? 1000: Number(animated); |
|
|
animated = animated == undefined ? 1000: Number(animated); |
|
|
if (pitch !== undefined) { |
|
|
|
|
|
|
|
|
if (pitch !== undefined && Math.abs(pitch - config.pitch) > eps) { |
|
|
this.setPitch(pitch, animated, callback, callbackArgs); |
|
|
this.setPitch(pitch, animated, callback, callbackArgs); |
|
|
callback = undefined; |
|
|
callback = undefined; |
|
|
} |
|
|
} |
|
|
if (yaw !== undefined) { |
|
|
|
|
|
|
|
|
if (yaw !== undefined && Math.abs(yaw - config.yaw) > eps) { |
|
|
this.setYaw(yaw, animated, callback, callbackArgs); |
|
|
this.setYaw(yaw, animated, callback, callbackArgs); |
|
|
callback = undefined; |
|
|
callback = undefined; |
|
|
} |
|
|
} |
|
|
if (hfov !== undefined) |
|
|
|
|
|
|
|
|
if (hfov !== undefined && Math.abs(hfov - config.hfov) > eps) { |
|
|
this.setHfov(hfov, animated, callback, callbackArgs); |
|
|
this.setHfov(hfov, animated, callback, callbackArgs); |
|
|
|
|
|
callback = undefined; |
|
|
|
|
|
} |
|
|
|
|
|
if (typeof callback == 'function') |
|
|
|
|
|
callback(callbackArgs); |
|
|
return this; |
|
|
return this; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|