From 475a0c24549c84ed6b88886c857c1cfaa19f08f3 Mon Sep 17 00:00:00 2001 From: 12fab4 <143189576+12fab4@users.noreply.github.com> Date: Fri, 28 Feb 2025 08:42:50 +0000 Subject: [PATCH] fix unnatural scrolldirection (#242) now when moving the mousewheel up config items get larger (which feels natural) --- src/main.ts | 2 ++ src/modules/evconf_konva/config_stage.ts | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 062841d8..702a3f16 100644 --- a/src/main.ts +++ b/src/main.ts @@ -44,5 +44,7 @@ app.provide( ], }), ); +// enable vue-devtools for debugging +// app.config.devtools = true; app.mount("#app"); diff --git a/src/modules/evconf_konva/config_stage.ts b/src/modules/evconf_konva/config_stage.ts index 88273ab3..188aa6d9 100644 --- a/src/modules/evconf_konva/config_stage.ts +++ b/src/modules/evconf_konva/config_stage.ts @@ -109,7 +109,17 @@ export default class ConfigStage { // if a trackpad does not give a proper delta, we have to reduce the speed, // because of the high amount of events triggered by a trackpad - const delta = event.evt.deltaY === 1 || event.evt.deltaY === -1 ? event.evt.deltaY * 0.2 : event.evt.deltaY; + + let delta: number; + if (event.evt.deltaY === 1 || event.evt.deltaY === -1) { + delta = event.evt.deltaY * 0.2; + } else { + delta = event.evt.deltaY; + } + + // invert delta as it is unnatural otherwise + delta = -delta; + const zoomIntensity = 0.005; // Adjust this value to control the zoom speed const scaleBy = Math.exp(delta * zoomIntensity);