From 7ce8ffb9bcb8fab9dc1f650d6f09a91720044b2e Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Wed, 21 Oct 2026 12:16:26 +0200 Subject: [PATCH] A wire a selection where it fits: green boxes over free pins in a row, and parts dropped onto a pin connect - Select several lamps, output pins, switches or gates: every run of free pins they fit on (nearest parts first) shows as a green box; pointing along it picks the pins (S0+S1, S1+S2, ...) with a preview, a click wires them all top to bottom - "Wire them all to" lists those fits, nearest first; the old pick-any-part stays under "Any part" - Dragging a part so a free pin lands on (or a square from) a pin it can join shows a green ring and connects on drop; Alt places it without connecting - A cable end only plugs in by itself when all its wires sit on the part; a name a part covers is hidden Co-Authored-By: Claude Opus 5.5 (1M context) --- app/assets/css/main.css | 58 +++++++ app/components/editor/BulkSettings.vue | 64 ++++++-- app/components/editor/Canvas.vue | 112 ++++++++++++- app/components/editor/Help.vue | 2 + app/composables/useEditor.ts | 17 ++ app/lib/logic/cables.ts | 15 +- app/lib/logic/fit.ts | 207 +++++++++++++++++++++++++ tests/fit.test.ts | 103 ++++++++++++ tests/plugs.test.ts | 15 ++ 9 files changed, 578 insertions(+), 15 deletions(-) create mode 100644 app/lib/logic/fit.ts create mode 100644 tests/fit.test.ts diff --git a/app/assets/css/main.css b/app/assets/css/main.css index c4e7594..9c8b85c 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -2358,6 +2358,64 @@ kbd { .lane.c-purple { --w-on: #b388ff; --w-off: #463768; } .lane.c-pink { --w-on: #ff7ac6; --w-off: #673657; } +/* Where the selection fits: green boxes over runs of free pins, and pins a dragged part lands on. */ +.fit-strip { + fill: rgb(61 220 132 / 0.16); + stroke: rgb(61 220 132 / 0.75); + stroke-width: 1.5; + cursor: pointer; +} + +.fit-strip.active { + fill: rgb(61 220 132 / 0.06); + stroke-dasharray: 3 3; +} + +.fit-window { + fill: rgb(61 220 132 / 0.32); + stroke: var(--on); + stroke-width: 2; + pointer-events: none; +} + +.fit-line { + fill: none; + stroke: var(--on); + stroke-width: 1.5; + stroke-dasharray: 4 4; + opacity: 0.85; + pointer-events: none; +} + +.fit-pin { + fill: none; + stroke: var(--on); + stroke-width: 2; + pointer-events: none; +} + +.drop-ring { + fill: rgb(61 220 132 / 0.25); + stroke: var(--on); + stroke-width: 2; + pointer-events: none; +} + +.fit-list { + display: flex; + flex-wrap: wrap; + gap: 4px; +} + +.fit-list .btn-sm.active { + border-color: var(--on); + color: var(--on); +} + +.fit-list .muted { + color: var(--muted); +} + .box-select.crossing { fill: rgb(61 220 132 / 0.08); stroke: var(--on); diff --git a/app/components/editor/BulkSettings.vue b/app/components/editor/BulkSettings.vue index d8556d6..51fd890 100644 --- a/app/components/editor/BulkSettings.vue +++ b/app/components/editor/BulkSettings.vue @@ -1,6 +1,7 @@