Browse Source

Add option to disable keyboard controls.

pull/723/head
Matthew Petroff 7 years ago
parent
commit
499fff145d
2 changed files with 11 additions and 3 deletions
  1. +5
    -0
      doc/json-config-parameters.md
  2. +6
    -3
      src/js/pannellum.js

+ 5
- 0
doc/json-config-parameters.md View File

@@ -98,6 +98,11 @@ viewer is fullscreen.
If set to `false`, mouse and touch dragging is disabled. Defaults to `true`.


### `disableKeyboardCtrl` (boolean)

If set to `true`, keyboard controls are disabled. Defaults to `false`.


### `showFullscreenCtrl` (boolean)

If set to `false`, the fullscreen control will not be displayed. Defaults to


+ 6
- 3
src/js/pannellum.js View File

@@ -101,6 +101,7 @@ var defaultConfig = {
backgroundColor: [0, 0, 0],
animationTimingFunction: timingFunction,
draggable: true,
disableKeyboardCtrl: false,
};

// Translatable / configurable strings
@@ -472,9 +473,11 @@ function onImageLoad() {
uiContainer.addEventListener('fullscreenchange', onFullScreenChange, false);
window.addEventListener('resize', onDocumentResize, false);
window.addEventListener('orientationchange', onDocumentResize, false);
container.addEventListener('keydown', onDocumentKeyPress, false);
container.addEventListener('keyup', onDocumentKeyUp, false);
container.addEventListener('blur', clearKeys, false);
if (!config.disableKeyboardCtrl) {
container.addEventListener('keydown', onDocumentKeyPress, false);
container.addEventListener('keyup', onDocumentKeyUp, false);
container.addEventListener('blur', clearKeys, false);
}
document.addEventListener('mouseleave', onDocumentMouseUp, false);
dragFix.addEventListener('touchstart', onDocumentTouchStart, false);
dragFix.addEventListener('touchmove', onDocumentTouchMove, false);


Loading…
Cancel
Save