diff --git a/.changeset/fixes_touchpad_zooming_behaviour.md b/.changeset/fixes_touchpad_zooming_behaviour.md new file mode 100644 index 000000000..da2040bf1 --- /dev/null +++ b/.changeset/fixes_touchpad_zooming_behaviour.md @@ -0,0 +1,5 @@ +--- +default: minor +--- + +# fixes touchpad zooming behaviour diff --git a/src/app/components/image-viewer/ImageViewer.tsx b/src/app/components/image-viewer/ImageViewer.tsx index e08430f1c..569b61df1 100644 --- a/src/app/components/image-viewer/ImageViewer.tsx +++ b/src/app/components/image-viewer/ImageViewer.tsx @@ -25,8 +25,15 @@ export const ImageViewer = as<'div', ImageViewerProps>( }; const handleWheel = (e: WheelEvent) => { - if (e.deltaY < 0) zoomIn(); - else zoomOut(); + const { deltaY } = e; + // Mouse wheel scrolls only by integer delta values, therefore + // If deltaY is an integer, then it's a mouse wheel action + if (Number.isInteger(deltaY)) { + if (deltaY < 0) { + zoomIn(); + } else zoomOut(); + } + // If it's not an integer, then it's a touchpad action, do nothing and let the browser handle the zooming }; return (