Просмотр исходного кода

Add option to disable keyboard controls.

pull/723/head
Matthew Petroff 7 лет назад
Родитель
Сommit
499fff145d
2 измененных файлов: 11 добавлений и 3 удалений
  1. +5
    -0
      doc/json-config-parameters.md
  2. +6
    -3
      src/js/pannellum.js

+ 5
- 0
doc/json-config-parameters.md Просмотреть файл

@@ -98,6 +98,11 @@ viewer is fullscreen.
If set to `false`, mouse and touch dragging is disabled. Defaults to `true`. 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) ### `showFullscreenCtrl` (boolean)


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


+ 6
- 3
src/js/pannellum.js Просмотреть файл

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


// Translatable / configurable strings // Translatable / configurable strings
@@ -472,9 +473,11 @@ function onImageLoad() {
uiContainer.addEventListener('fullscreenchange', onFullScreenChange, false); uiContainer.addEventListener('fullscreenchange', onFullScreenChange, false);
window.addEventListener('resize', onDocumentResize, false); window.addEventListener('resize', onDocumentResize, false);
window.addEventListener('orientationchange', 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); document.addEventListener('mouseleave', onDocumentMouseUp, false);
dragFix.addEventListener('touchstart', onDocumentTouchStart, false); dragFix.addEventListener('touchstart', onDocumentTouchStart, false);
dragFix.addEventListener('touchmove', onDocumentTouchMove, false); dragFix.addEventListener('touchmove', onDocumentTouchMove, false);


Загрузка…
Отмена
Сохранить