feat(ui): double-click a port to start a cable draw
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user