diff --git a/app/components/editor/App.vue b/app/components/editor/App.vue index 7e349d8..db4cc7f 100644 --- a/app/components/editor/App.vue +++ b/app/components/editor/App.vue @@ -68,7 +68,7 @@ watch( - Click the pin {{ link.dir === 'out' ? 'it goes to' : 'it comes from' }}, or a part to use its next free pin. Esc stops. + Click the pin {{ link.dir === 'out' ? 'it goes to' : 'it comes from' }}, or a part to use its next free pin. Shift + click: one more from the same signal. Esc stops. diff --git a/app/components/editor/Canvas.vue b/app/components/editor/Canvas.vue index 797f282..8d10b11 100644 --- a/app/components/editor/Canvas.vue +++ b/app/components/editor/Canvas.vue @@ -462,7 +462,7 @@ function onPointerDown(e: PointerEvent) { if (end) { // Connecting: a click on a pin or a part wires the current pin there. const target = targetAt(w, end.dir === 'out' ? 'in' : 'out', ed.pinKind(end.node, end.pin, end.dir)) - if (target) return ed.linkTo(target) + if (target) return ed.linkTo(target, e.shiftKey) const pinEl = (e.target as Element).closest('[data-pin]') if (pinEl && link.queue.length === 1) { // Another pin of the same kind: start from that one instead. @@ -878,6 +878,8 @@ function onPointerUp(e: PointerEvent) { } if (d.dir === 'in') { ed.connect(target, here) + // Let go with Shift: go on from the output it now comes from. + if (e.shiftKey) ed.linking.value = { queue: [{ ...target, dir: 'out', label: '' }], at: 0 } break } let corners = d.branch @@ -889,6 +891,8 @@ function onPointerUp(e: PointerEvent) { corners = branchTo(corners, [a.x, a.y], [b.x, b.y]) } ed.connect(here, target, corners) + // Let go with Shift: the wire goes on from the same output, for another connection. + if (e.shiftKey) ed.linking.value = { queue: [{ ...here, dir: 'out', label: '' }], at: 0 } break } case 'segment': diff --git a/app/components/editor/Help.vue b/app/components/editor/Help.vue index a0a14d4..85790c0 100644 --- a/app/components/editor/Help.vue +++ b/app/components/editor/Help.vue @@ -9,6 +9,7 @@ const SHORTCUTS: [string, string][] = [ ['Pins (panel on the left)', 'Every input and output in one list: rename them one after another with Enter'], ['Drag from a pin', 'Draw a wire to another pin; dropping it on a part uses that part’s next free pin'], ['Click a pin, then another', 'The same without holding the mouse button'], + ['Shift + click (or let go) on a pin while wiring', 'Connects it and keeps wiring from the same signal: click more pins, Esc stops'], ['Select parts, then W', 'Connect one by one: click where each of their pins goes, in order (Shift+W: their inputs)'], ['Drag a wire segment', 'Move that segment; drag a corner square to move a bend'], ['Alt + drag a wire', 'Pull a new bend out of it'], diff --git a/app/composables/useEditor.ts b/app/composables/useEditor.ts index 62c74ff..3f6ad7d 100644 --- a/app/composables/useEditor.ts +++ b/app/composables/useEditor.ts @@ -1215,14 +1215,24 @@ function create() { linking.value = { queue, at: 0 } } - /** Wires the pin whose turn it is to `target`, then moves on to the next one. */ - function linkTo(target: PinRef) { + /** + * Wires the pin whose turn it is to `target`, then moves on to the next one. + * With `more` (Shift), the wire keeps following the mouse from the same + * signal for another connection: from the same output, or, when it started + * at an input, from the output just wired to it. + */ + function linkTo(target: PinRef, more = false) { const l = linking.value const cur = l?.queue[l.at] if (!l || !cur) return const here = { node: cur.node, pin: cur.pin } if (cur.dir === 'out') connect(here, target) else connect(target, here) + if (more && cur.dir === 'out') return + if (more && l.queue.length === 1) { + linking.value = { queue: [{ ...target, dir: 'out', label: '' }], at: 0 } + return + } l.at++ if (l.at >= l.queue.length) { linking.value = null