Przeglądaj źródła

Add option to disable keyboard controls.

pull/723/head
Matthew Petroff 7 lat temu
rodzic
commit
499fff145d
2 zmienionych plików z 11 dodań i 3 usunięć
  1. +5
    -0
      doc/json-config-parameters.md
  2. +6
    -3
      src/js/pannellum.js

+ 5
- 0
doc/json-config-parameters.md Wyświetl plik

@@ -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 Wyświetl plik

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


Ładowanie…
Anuluj
Zapisz