Procházet zdrojové kódy

Add option to disable keyboard controls.

pull/723/head
Matthew Petroff před 7 roky
rodič
revize
499fff145d
2 změnil soubory, kde provedl 11 přidání a 3 odebrání
  1. +5
    -0
      doc/json-config-parameters.md
  2. +6
    -3
      src/js/pannellum.js

+ 5
- 0
doc/json-config-parameters.md Zobrazit soubor

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

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


Načítá se…
Zrušit
Uložit