From 825861a6332a3530db1096ccfa8a0fbfa8b4f2ba Mon Sep 17 00:00:00 2001 From: praefectius Date: Sat, 20 Jun 2020 01:35:35 +0200 Subject: [PATCH] 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 --- src/js/pannellum.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 931782d..f336a03 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -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; };