From e601519157beb9ef50f2a755f15ceebb02e2545b Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sat, 13 Feb 2021 11:14:59 -0500 Subject: [PATCH] Disable `ctrl` / `shift` zoom when `ctrl` is required for mouse wheel zoom. --- doc/json-config-parameters.md | 3 ++- src/js/pannellum.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/json-config-parameters.md b/doc/json-config-parameters.md index 4e887a1..b4e1c58 100644 --- a/doc/json-config-parameters.md +++ b/doc/json-config-parameters.md @@ -101,7 +101,8 @@ If set to `false`, zooming with mouse wheel will be disabled. Defaults to `true` Can also be set to `fullscreenonly`, in which case it is only enabled when the viewer is fullscreen. Can also be set to `ctrl`, in which case the `ctrl` key must be held down to zoom with the mouse wheel (except while the viewer is -fullscreen). +fullscreen); when the `ctrl` key is required for mouse wheel zooming, the use +of `ctrl` / `shift` for zoom control is disabled. ### `doubleClickZoom` (boolean) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index b2c2060..92da510 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -1177,6 +1177,10 @@ function onDocumentKeyPress(event) { // Override default action for keys that are used if (config.capturedKeyNumbers.indexOf(keynumber) < 0) return; + if (!fullscreenActive && (keynumber == 16 || keynumber == 17) && config.mouseZoom == 'ctrl') + // Disable ctrl / shift zoom when holding the ctrl key is required for + // scroll wheel zooming + return; event.preventDefault(); // If escape key is pressed