diff --git a/src/components/EditorCanvas/Canvas.jsx b/src/components/EditorCanvas/Canvas.jsx index 8a6a9ad4f..1b6bf34e8 100644 --- a/src/components/EditorCanvas/Canvas.jsx +++ b/src/components/EditorCanvas/Canvas.jsx @@ -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 {