Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -3007,10 +3008,16 @@ function init_zoom_buttons() {
let zoom_minus = $("<div id='zoom_minus' class='ddbc-tab-options--layout-pill'><div class='ddbc-tab-options__header-heading hasTooltip button-icon hideable' data-name='zoom out (-)'><span class='material-icons button-icon'>zoom_out</span></div></div>");

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 = $("<div id='zoom_plus' class='ddbc-tab-options--layout-pill'><div class='ddbc-tab-options__header-heading hasTooltip button-icon hideable' data-name='zoom in (+)'><span class='material-icons button-icon'>zoom_in</span></div></div>");
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 = $(`<div id='hide_interface_button' class='ddbc-tab-options--layout-pill'><div class='ddbc-tab-options__header-heading hasTooltip button-icon' data-name='Unhide interface (shift+h)'><span class='material-icons md-16 button-icon'>visibility</span></div></div>`);
Expand Down
15 changes: 15 additions & 0 deletions Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
];

Expand Down Expand Up @@ -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){
Expand Down