touchpad sensitivity down

This commit is contained in:
poanse 2026-02-03 14:13:20 +03:00
parent 12218d10ba
commit 3e03d89688
2 changed files with 23 additions and 3 deletions

View file

@ -53,7 +53,29 @@
}
function onwheel(e: WheelEvent) {
getPanzoom().zoomWithWheel(e);
let scaledEvent: WheelEvent;
const isTouchpad = Math.abs(e.deltaY) < 50;
if (isTouchpad) {
// Create a modified event with scaled deltaY for touchpad
const scaleConstant = 0.2;
scaledEvent = new WheelEvent('wheel', {
deltaY: e.deltaY * scaleConstant,
deltaX: e.deltaX * scaleConstant,
deltaMode: e.deltaMode,
clientX: e.clientX,
clientY: e.clientY,
ctrlKey: e.ctrlKey,
shiftKey: e.shiftKey,
altKey: e.altKey,
metaKey: e.metaKey,
button: e.button,
buttons: e.buttons,
});
} else {
scaledEvent = e;
}
getPanzoom().zoomWithWheel(scaledEvent);
context.setScale(getPanzoom().getScale());
if (getPanzoom().getScale() > 1) {
context.incrementUpdateOnZoomCounter();

View file

@ -7,7 +7,6 @@
TOOLBAR_SIZE, TASK_SIZE, TOOLBAR_SHIFT, SUBTOOLBAR_SHIFT, SUBTOOLBAR_BUTTON_SIZE, SUBTOOLBAR_GAP,
SUBTOOLBAR_PADDING
} from "../Constants";
// 1. Import the transition you want
import {quintOut} from 'svelte/easing';
import {slideCustom} from '../Custom';
import type {Context} from "../Context.svelte.js";
@ -66,7 +65,6 @@
let subtoolbarTopShift = (buttons: IconCode[]) => {
return - (buttons.length * SUBTOOLBAR_BUTTON_SIZE + (buttons.length -1)*SUBTOOLBAR_GAP + 2*SUBTOOLBAR_PADDING.y + SUBTOOLBAR_SHIFT);
};
</script>
{#if !context.taskDraggingManager.isDragging}