Skip to content

Commit

Permalink
fix unnatural scrolldirection (#242)
Browse files Browse the repository at this point in the history
now when moving the mousewheel up config items get larger (which feels natural)
  • Loading branch information
12fab4 authored Feb 28, 2025
1 parent 621928c commit 475a0c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ app.provide(
],
}),
);
// enable vue-devtools for debugging
// app.config.devtools = true;

app.mount("#app");
12 changes: 11 additions & 1 deletion src/modules/evconf_konva/config_stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 475a0c2

Please sign in to comment.