From 9412049f560a94efe723e926621e29ca3496813c Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Wed, 30 Sep 2026 21:29:17 +0530 Subject: [PATCH] feat(flowchart): wire zoom/pan/snap into canvas (C5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - All canvas content (nodes, edges, preview line) now lives inside a single so a single attribute change moves/zooms everything together. The fixed viewBox (1000x700) stays — the transform handles everything. - Ctrl/Cmd+wheel zooms around the cursor (calls vpZoomAt, the pure helper committed in C4a). - Shift-drag (or middle-click) on empty canvas pans the view. - Snap-to-grid (10-unit) is opt-in via api.setSnapEnabled(true). When on, moveNode and addNode clamp coords to the grid. - Plain click on empty canvas still hands off to opts.onEmptyClick so the controller can prompt for shape kind + label. destroy() now also removes the wheel listener. Amit Haridas --- src/flowchart/flowchart-canvas.js | 97 ++++++++++++++++++++++++++++--- 1 file changed, 89 insertions(+), 8 deletions(-) diff --git a/src/flowchart/flowchart-canvas.js b/src/flowchart/flowchart-canvas.js index f1a591c..b5cf669 100644 --- a/src/flowchart/flowchart-canvas.js +++ b/src/flowchart/flowchart-canvas.js @@ -18,7 +18,15 @@ // a