From 0784f425dc6730defdc5d8e7510a097b002ea0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20H=C3=B6llerich?= Date: Sat, 20 Jun 2020 19:51:22 +0200 Subject: [PATCH] Remove orientationAlignNorth, getters and setters for orientationOnByDefault, and orientationSupport for android regardless of the protocol. --- doc/json-config-parameters.md | 6 ------ src/js/pannellum.js | 21 ++++----------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/doc/json-config-parameters.md b/doc/json-config-parameters.md index 1c21e96..b1e6d29 100644 --- a/doc/json-config-parameters.md +++ b/doc/json-config-parameters.md @@ -85,12 +85,6 @@ to be activated by pressing a button. Defaults to `false`. Note that a secure HTTPS connection is required for device orientation access in most browsers. -### `orientationAlignNorth` (boolean) - -If set to `true` and device orientation control is used, the yaw of the panorama -is set to the azimuth of the device. Defaults to `false`. - - ### `showZoomCtrl` (boolean) If set to `false`, the zoom controls will not be displayed. Defaults to `true`. diff --git a/src/js/pannellum.js b/src/js/pannellum.js index d809bb7..6580be0 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -102,7 +102,6 @@ var defaultConfig = { autoLoad: false, showControls: true, orientationOnByDefault: false, - orientationAlignNorth: false, hotSpotDebug: false, backgroundColor: [0, 0, 0], avoidShowingBackground: false, @@ -257,7 +256,7 @@ controls.orientation.addEventListener('touchstart', function(e) {e.stopPropagati controls.orientation.addEventListener('pointerdown', function(e) {e.stopPropagation();}); controls.orientation.className = 'pnlm-orientation-button pnlm-orientation-button-inactive pnlm-sprite pnlm-controls pnlm-control'; var orientationSupport = false; - if (window.DeviceOrientationEvent && (location.protocol == 'https:' || navigator.userAgent.toLowerCase().indexOf('android')) && +if (window.DeviceOrientationEvent && location.protocol == 'https:' && navigator.userAgent.toLowerCase().indexOf('mobi') >= 0) { // This user agent check is here because there's no way to check if a // device has an inertia measurement unit. We used to be able to check if a @@ -1654,7 +1653,7 @@ function orientationListener(e) { orientation += 1; } else if (orientation === 10) { // Record starting yaw to prevent jumping - orientationYawOffset = q[2] / Math.PI * 180 + (config.orientationAlignNorth ? (config.northOffset || 0) : config.yaw); + orientationYawOffset = q[2] / Math.PI * 180 + config.yaw; orientation = true; requestAnimationFrame(animate); } else { @@ -2379,8 +2378,8 @@ function loadScene(sceneId, targetPitch, targetYaw, targetHfov, fadeDone) { fadeImg.onload = function() { loadScene(sceneId, targetPitch, targetYaw, targetHfov, true); }; + fadeImg.src = data; renderContainer.appendChild(fadeImg); - fadeImg.src = data; renderer.fadeImg = fadeImg; return; } @@ -2446,7 +2445,7 @@ function stopOrientation() { function startOrientation() { if (!orientationSupport) return; - if (typeof DeviceMotionEvent !== undefined && + if (typeof DeviceMotionEvent !== 'undefined' && typeof DeviceMotionEvent.requestPermission === 'function') { DeviceOrientationEvent.requestPermission().then(function(response) { if (response == 'granted') { @@ -2932,18 +2931,6 @@ this.setUpdate = function(bool) { }; /** - * Sets update flag for dynamic content. - * @memberof Viewer - * @instance - * @param {boolean} bool - Whether or not orientation is enabled by default - * @returns {Viewer} `this` - */ -this.setOrientationOnByDefault = function (bool) { - config.orientationOnByDefault = bool === true; - return this; -} - -/** * Calculate panorama pitch and yaw from location of mouse event. * @memberof Viewer * @instance