From eff7d9f997963ac9c07f3124ce76eb8ad00368f1 Mon Sep 17 00:00:00 2001 From: Jason Surya Faylim Date: Tue, 3 Dec 2024 02:01:00 +0700 Subject: [PATCH] feat: add horizontal scrolling for wheel panning by holding the shift key --- src/core/instance.core.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/instance.core.ts b/src/core/instance.core.ts index 38bdb6be..6bd1d003 100644 --- a/src/core/instance.core.ts +++ b/src/core/instance.core.ts @@ -259,9 +259,10 @@ export class ZoomPanPinch { event.preventDefault(); event.stopPropagation(); + const shiftPressed = event.shiftKey; const { positionX, positionY } = this.transformState; - const mouseX = positionX - event.deltaX; - const mouseY = positionY - event.deltaY; + const mouseX = positionX - (shiftPressed ? event.deltaY : event.deltaX); + const mouseY = positionY - (shiftPressed ? event.deltaX : event.deltaY); const newPositionX = panning.lockAxisX ? positionX : mouseX; const newPositionY = panning.lockAxisY ? positionY : mouseY;