Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fixes_touchpad_zooming_behaviour.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: minor
---

# fixes touchpad zooming behaviour
11 changes: 9 additions & 2 deletions src/app/components/image-viewer/ImageViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Loading