Explorar el Código

Remove orientationAlignNorth, getters and setters for orientationOnByDefault, and orientationSupport for android regardless of the protocol.

pull/881/head
Nico Höllerich hace 4 años
padre
commit
0784f425dc
Se han modificado 2 ficheros con 4 adiciones y 23 borrados
  1. +0
    -6
      doc/json-config-parameters.md
  2. +4
    -17
      src/js/pannellum.js

+ 0
- 6
doc/json-config-parameters.md Ver fichero

@@ -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`.


+ 4
- 17
src/js/pannellum.js Ver fichero

@@ -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


Cargando…
Cancelar
Guardar