Sfoglia il codice sorgente

Update pannellum.js

Added a JSON config option to stop autorotate after a certain time (counting from when the autorotate started).

The name of the configuration option is `autoRotateStopAfter` and by default is inactive.

That can be useful for when we want the image to autorotate in a interval (between x and y).
pull/44/head
Didac 9 anni fa
parent
commit
069a3a3004
1 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  1. +8
    -1
      src/js/pannellum.js

+ 8
- 1
src/js/pannellum.js Vedi File

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

var defaultConfig = {
@@ -646,9 +647,10 @@ function keyRepeat() {
// If auto-rotate
var inactivityInterval = Date.now() - latestInteraction;
if (config.autoRotate && inactivityInterval > config.autoRotateInactivityDelay) {
if ((config.autoRotate && inactivityInterval > config.autoRotateInactivityDelay) && (rotationStarted == 0 || ((Date.now() - rotationStarted) < config.autoRotateStopAfter))) {
// Pan
if (diff > 0.000001) {
rotationStarted = rotationStarted == 0 ? Date.now() : rotationStarted;
config.yaw -= config.autoRotate / 60 * diff;
}
}
@@ -1092,6 +1094,11 @@ function processOptions() {
// Start the auto-rotate only after user inactivity (milliseconds):
config.autoRotateInactivityDelay = config[key];
break;
case 'autoRotateStopAfter':
// Stop the auto-rotate after a certain time (milliseconds):
config.autoRotateStopAfter = config[key];
break;
case 'header':
// Add contents to header


Caricamento…
Annulla
Salva