Browse Source

Clean up just merged pull request.

pull/47/head
Matthew Petroff 9 years ago
parent
commit
2e08057aa2
2 changed files with 24 additions and 7 deletions
  1. +7
    -0
      doc/json-config-parameters.md
  2. +17
    -7
      src/js/pannellum.js

+ 7
- 0
doc/json-config-parameters.md View File

@@ -49,6 +49,13 @@ after user activity ceases. This parameter only has an effect if the
`autoRotate` parameter is set.


### `autoRotateStopDelay`

Sets the delay, in milliseconds, to stop automatically rotating the panorama
after it is loaded. This parameter only has an effect if the `autoRotate`
parameter is set.


### `fallback`

If set, the value is used as a URL for a fallback viewer in case Pannellum is


+ 17
- 7
src/js/pannellum.js View File

@@ -50,7 +50,6 @@ var config,
yawSpeed = 0,
pitchSpeed = 0,
zoomSpeed = 0,
rotationStarted = 0,
hotspotsCreated = false;

var defaultConfig = {
@@ -608,6 +607,9 @@ function keyRepeat() {
} else {
newTime = Date.now();
}
if (prevTime === undefined) {
prevTime = newTime;
}
var diff = (newTime - prevTime) * config.hfov / 1700;
diff = Math.min(diff, 1.0);
@@ -647,12 +649,20 @@ function keyRepeat() {
// If auto-rotate
var inactivityInterval = Date.now() - latestInteraction;
if ((config.autoRotate && inactivityInterval > config.autoRotateInactivityDelay) && (rotationStarted == 0 || ((Date.now() - rotationStarted) < config.autoRotateStopAfter))) {
if (config.autoRotate && inactivityInterval > config.autoRotateInactivityDelay
&& config.autoRotateStopDelay !== false) {
// Pan
if (diff > 0.000001) {
rotationStarted = rotationStarted == 0 ? Date.now() : rotationStarted;
config.yaw -= config.autoRotate / 60 * diff;
}
// Deal with stopping auto rotation after a set delay
if (config.autoRotateStopDelay) {
config.autoRotateStopDelay -= newTime - prevTime;
if (config.autoRotateStopDelay <= 0) {
config.autoRotateStopDelay = false;
}
}
}

// "Inertia"
@@ -1095,10 +1105,10 @@ function processOptions() {
config.autoRotateInactivityDelay = config[key];
break;
case 'autoRotateStopAfter':
// Stop the auto-rotate after a certain time (milliseconds):
config.autoRotateStopAfter = config[key];
break;
case 'autoRotateStopDelay':
// Stop the auto-rotate after a certain delay (milliseconds):
config.autoRotateStopDelay = config[key];
break;
case 'header':
// Add contents to header


Loading…
Cancel
Save