A Shift while wiring: connect and go on from the same signal
Shift + click on a pin while a wire follows the mouse connects it and keeps wiring from the same output, so one signal fans out to several pins in a row; Esc or a plain click ends it. Started at an input, it goes on from the output just wired to it. Letting go of a dragged wire with Shift held does the same. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
55bba95098
commit
51d71e2564
|
|
@ -68,7 +68,7 @@ watch(
|
||||||
<template v-if="link.total > 1">
|
<template v-if="link.total > 1">
|
||||||
<strong>{{ link.n }} of {{ link.total }}<template v-if="link.label">: {{ link.label }}</template></strong> ·
|
<strong>{{ link.n }} of {{ link.total }}<template v-if="link.label">: {{ link.label }}</template></strong> ·
|
||||||
</template>
|
</template>
|
||||||
Click the pin {{ link.dir === 'out' ? 'it goes to' : 'it comes from' }}, or a part to use its next free pin. <kbd>Esc</kbd> stops.
|
Click the pin {{ link.dir === 'out' ? 'it goes to' : 'it comes from' }}, or a part to use its next free pin. <kbd>Shift</kbd> + click: one more from the same signal. <kbd>Esc</kbd> stops.
|
||||||
</div>
|
</div>
|
||||||
<EditorTruthTableDialog v-if="ed.dialog.value === 'table'" />
|
<EditorTruthTableDialog v-if="ed.dialog.value === 'table'" />
|
||||||
<EditorPublishDialog v-if="ed.dialog.value === 'publish'" />
|
<EditorPublishDialog v-if="ed.dialog.value === 'publish'" />
|
||||||
|
|
|
||||||
|
|
@ -462,7 +462,7 @@ function onPointerDown(e: PointerEvent) {
|
||||||
if (end) {
|
if (end) {
|
||||||
// Connecting: a click on a pin or a part wires the current pin there.
|
// 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))
|
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]')
|
const pinEl = (e.target as Element).closest('[data-pin]')
|
||||||
if (pinEl && link.queue.length === 1) {
|
if (pinEl && link.queue.length === 1) {
|
||||||
// Another pin of the same kind: start from that one instead.
|
// Another pin of the same kind: start from that one instead.
|
||||||
|
|
@ -878,6 +878,8 @@ function onPointerUp(e: PointerEvent) {
|
||||||
}
|
}
|
||||||
if (d.dir === 'in') {
|
if (d.dir === 'in') {
|
||||||
ed.connect(target, here)
|
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
|
break
|
||||||
}
|
}
|
||||||
let corners = d.branch
|
let corners = d.branch
|
||||||
|
|
@ -889,6 +891,8 @@ function onPointerUp(e: PointerEvent) {
|
||||||
corners = branchTo(corners, [a.x, a.y], [b.x, b.y])
|
corners = branchTo(corners, [a.x, a.y], [b.x, b.y])
|
||||||
}
|
}
|
||||||
ed.connect(here, target, corners)
|
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
|
break
|
||||||
}
|
}
|
||||||
case 'segment':
|
case 'segment':
|
||||||
|
|
|
||||||
|
|
@ -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'],
|
['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'],
|
['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'],
|
['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)'],
|
['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'],
|
['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'],
|
['Alt + drag a wire', 'Pull a new bend out of it'],
|
||||||
|
|
|
||||||
|
|
@ -1215,14 +1215,24 @@ function create() {
|
||||||
linking.value = { queue, at: 0 }
|
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 l = linking.value
|
||||||
const cur = l?.queue[l.at]
|
const cur = l?.queue[l.at]
|
||||||
if (!l || !cur) return
|
if (!l || !cur) return
|
||||||
const here = { node: cur.node, pin: cur.pin }
|
const here = { node: cur.node, pin: cur.pin }
|
||||||
if (cur.dir === 'out') connect(here, target)
|
if (cur.dir === 'out') connect(here, target)
|
||||||
else connect(target, here)
|
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++
|
l.at++
|
||||||
if (l.at >= l.queue.length) {
|
if (l.at >= l.queue.length) {
|
||||||
linking.value = null
|
linking.value = null
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue