diff --git a/Main.js b/Main.js index 88948eab2..9ab890d87 100644 --- a/Main.js +++ b/Main.js @@ -1277,7 +1277,8 @@ function init_mouse_zoom() { if(window.mouseZoomInitialized) return; window.mouseZoomInitialized = true; window.addEventListener('wheel', function (e) { - if (e.ctrlKey) { + const wheelZoomAsToggle = get_avtt_setting_value?.('wheelZoomAsToggle') === true; + if (e.ctrlKey || wheelZoomAsToggle) { e.preventDefault(); e.stopPropagation(); if (e.deltaY > MAX_ZOOM_STEP) { @@ -3007,10 +3008,16 @@ function init_zoom_buttons() { let zoom_minus = $("
"); zoom_minus.click(function() { throttledZoom(0.90, 0)}); + if (get_avtt_setting_value?.('wheelZoomAsToggle') === true) { + zoom_minus.hide(); + } zoom_section.append(zoom_minus); let zoom_plus = $(""); zoom_plus.click(function() { throttledZoom(1.10, 0)}); + if (get_avtt_setting_value?.('wheelZoomAsToggle') === true) { + zoom_plus.hide(); + } zoom_section.append(zoom_plus); let hide_interface = $(``); diff --git a/Settings.js b/Settings.js index 751df7796..9190d7def 100644 --- a/Settings.js +++ b/Settings.js @@ -442,6 +442,18 @@ function avtt_settings() { defaultValue: false, class: 'ui', global: 1 + }, + { + name: "wheelZoomAsToggle", + label: "Wheel Zoom as Toggle", + type: "toggle", + options: [ + { value: true, label: "Enable", description: `Mouse wheel will act as a toggle for zoom` }, + { value: false, label: "Disable", description: `Mouse wheel will behave normally (continuous zoom)` } + ], + defaultValue: false, + class: 'ui', + global: 1 } ]; @@ -1065,6 +1077,9 @@ function set_avtt_setting_value(name, newValue) { case "alwaysHideScrollbar": hide_or_unhide_scrollbar(); break; + case "wheelZoomAsToggle": + $('#zoom_plus, #zoom_minus').toggle(!(newValue === true)); + break; } } function clear_avtt_setting(name){