Skip to content
Open
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
10 changes: 8 additions & 2 deletions src/components/EditorCanvas/Canvas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -699,12 +699,18 @@ export default function Canvas() {
},
zoom: e.deltaY <= 0 ? prev.zoom * 1.05 : prev.zoom / 1.05,
}));
} else if (e.shiftKey) {
} else if (e.shiftKey || e.deltaX !== 0) {
// Browsers disagree about where a horizontal scroll arrives. Chrome
// translates shift + wheel into deltaX and leaves deltaY at 0, so
// reading deltaY alone added nothing and the diagram did not move.
// Firefox keeps it on deltaY with shiftKey set. A trackpad or a tilt
// wheel sends deltaX with no modifier at all.
const horizontal = e.deltaX !== 0 ? e.deltaX : e.deltaY;
setTransform((prev) => ({
...prev,
pan: {
...prev.pan,
x: prev.pan.x + e.deltaY / prev.zoom,
x: prev.pan.x + horizontal / prev.zoom,
},
}));
} else {
Expand Down
Loading