From 0ecd9c8b4a097a73bf468ac28e29e37915153d6f Mon Sep 17 00:00:00 2001 From: mAi Date: Sat, 16 May 2026 13:29:02 +0200 Subject: [PATCH] feat(ui): double-click a port to start a cable draw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Double-click a port → enter cable-draw mode from that port without having to arm the cable tool first. armTool("cable") is called so the crosshair cursor is active during the draw; the next port-click hits the existing cable-draw-in-progress branch in onPortPointerDown and commits the cable. Esc / clicking the source port cancels. Single-click behaviour (select + open port inspector) is unchanged because pointerdown still hits onPortPointerDown first; dblclick upgrades the selection to a cable-draw source. --- web/static/main.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/web/static/main.js b/web/static/main.js index 1116ce7..1034e8b 100644 --- a/web/static/main.js +++ b/web/static/main.js @@ -471,6 +471,18 @@ function renderCanvas() { }); // Port-click drives both cable-draw (slice 7) and port-select (this fix). c.addEventListener("pointerdown", (e) => onPortPointerDown(e, prt)); + // Double-click activates cable-draw mode from this port without arming + // the cable tool first. armTool("cable") gives the crosshair cursor; + // the next port-click is then caught by onPortPointerDown's + // cable-draw-in-progress branch and commits the cable. + c.addEventListener("dblclick", (e) => { + e.stopPropagation(); + e.preventDefault(); + if (state.tool !== "cable") armTool("cable"); + state.cableDrawFromPortID = prt.id; + state.selection = null; + render(); + }); g.append(c); }