fix(web): allow MazeNET canvas pan from inside net-box body
Pan drag previously required mousedown on the bare canvas (target === currentTarget). When zoomed in, net-boxes cover most of the viewport so there was no bare grid to grab. Drop the guard — node/header/port/ resize handlers all call stopPropagation() already, so only net-box body mousedowns bubble up to start the pan, which is exactly what we want.
This commit is contained in:
@@ -87,7 +87,10 @@ export function useMazeInteraction({ nets, nodes, setNets, setNodes, canvasRef,
|
||||
|
||||
const onCanvasMouseDown = useCallback((e: React.MouseEvent) => {
|
||||
if (e.button !== 0) return;
|
||||
if (e.target !== e.currentTarget) return;
|
||||
// Pan starts whenever a left-mousedown bubbles up to the canvas.
|
||||
// Node/header/resize/port handlers call stopPropagation() and never
|
||||
// reach here; net-box body mousedowns DO bubble so you can pan from
|
||||
// "inside" a LAN when zoomed in and no bare grid is visible.
|
||||
setDrag({ type: 'pan', startX: e.clientX, startY: e.clientY, panX: panRef.current.x, panY: panRef.current.y });
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user