Parcourir la source

startAutoRotate | possible improvement (#883)

* pannellum.js | possible improvement

startAutoRotate = function(speed, pitch, hfov)

Use case:

1. by using "getPitch()" and "getHfov()" as parameter you can just rotate your panorama with the current view.
2. if origHfov is set to a small value (eg. to start with a highlight inside a big panorama) you still can use startAutoRotate with a wider view

* Update pannellum.js
pull/918/head
praefectius il y a 4 ans
committed by GitHub
Parent
révision
825861a633
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: 4AEE18F83AFDEB23
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. +4
    -2
      src/js/pannellum.js

+ 4
- 2
src/js/pannellum.js Voir le fichier

@@ -2806,13 +2806,15 @@ this.setHorizonPitch = function(pitch) {
* @instance
* @param {number} [speed] - Auto rotation speed / direction. If not specified, previous value is used.
* @param {number} [pitch] - The pitch to rotate at. If not specified, inital pitch is used.
* @param {number} [hfov] - The hfov to rotate at. If not specified, inital hfov is used.
* @returns {Viewer} `this`
*/
this.startAutoRotate = function(speed, pitch) {
this.startAutoRotate = function(speed, pitch, hfov) {
speed = speed || autoRotateSpeed || 1;
pitch = pitch === undefined ? origPitch : pitch;
hfov = hfov === undefined ? origHfov : hfov;
config.autoRotate = speed;
_this.lookAt(pitch, undefined, origHfov, 3000);
_this.lookAt(pitch, undefined, hfov, 3000);
animateInit();
return this;
};


Chargement…
Annuler
Enregistrer