Expand description
Route (re)solving for a level: the closed-graph solver every commit and every drag/resize preview goes through, the per-leg reconstruction that rebuilds a route’s geometry from its stored corners, and the rip-up/reroute entry points.
Split out of Drawing’s core so the routing policy — when a route is left
alone, straightened, or re-solved — reads as one thing.
Structs§
- Edited
- What the gesture wrote, as the rider has to read it: the ops staged so far, and the footprints their shapes have left — which the staged document no longer holds, so nothing downstream can derive them.
- Geometry
Overrides 🔒 - The hypothetical geometry one solve runs against: dragged/resized shapes at previewed rects, dragged pins at previewed slots. Empty for a settled document (a commit, or a preview whose overrides ride in elsewhere).
- PinSlot
Override - A pin sitting at a hypothetical slot for one preview frame: routes anchored to it solve as if the pin were already there, without moving it.
- Preview
Exclusions 🔒 - The corners one preview frame previews deleted without deleting them: the
straddle trim plus any backtracking prune, computed against the frame’s
hypothetical endpoints.
prunedmirrors the commit pass’s “a prune happened, so the route must re-solve” trigger; a trim alone does not force one (matching the mutating flow, where trims never did). - Preview
Spec 🔒 - What a preview frame previews without committing.
insideclassifies each route endpoint as riding the gesture: a route fully inside previews its waypoints offset rigidly bygrid_delta; a straddling route (exactly one end riding) has its moved-side approach corners computed as trimmed — the commit applies the real trim on drop. - Rerouting 🔒
- A wire a preview frame reroutes: its ends, the waypoints it routes through, and — for one riding entirely inside a group drag — the offset those waypoints ride at.
- Route
Edit Session - One route edit’s working-corner plan, built on the drag’s first frame
(
Drawing::route_edit_session) and applied only on release (Drawing::commit_route_edit): where each dragged corner enters the stored waypoint list, plus each label’s world position at drag start — re-imposed on every relayout so labels stay put while the wire moves under them. Between build and commit the document is never written; the per-frame preview relays the hypothetical corner list into derived state. - Seeding 🔒
- What a lattice is built from: the hypothetical geometry it holds shapes at, and every route’s endpoints and waypoints, which it must hold a node for.
Enums§
- Reconstructing 🔒
- Which of a scope’s wires a reconstruction re-derives. The rest keep the geometry they have, which is still what the document implies — nothing moved near them.
- Region 🔒
- How much of the routing plane a lattice covers. A local edit has local effects, so there is no reason a router built to move one block has to hold the whole diagram.
- Riding 🔒
- How much of the scope one ride re-solves.
- Route
Pass 🔒 - Whether a routing pass is the live preview or the committed result. A preview never mutates the document — it solves against hypothetical geometry into the derived store; only a commit rewrites waypoints.
- Solving 🔒
- Which of a scope’s wires a pass may re-solve. The rest are not skipped — they contribute their occupancy — they are simply not re-decided.
- Waypoint
Slot 🔒 - Where one working corner lands in the stored waypoint list: a grabbed existing corner (moved in place) or a fresh insertion.
Functions§
- healing_
region 🔒 - The rectangle to heal: what the wires needing a lattice span, with room around them to get past whatever is refusing them.
- keyed_
corners 🔒 - The stored corners as a working list keyed by the ordinal each holds in
the document. Shared by the plan and its replay rather than written twice:
both count positions in this list, and a list built two ways is two
different meanings for the same
InsertAt. - obstacle_
rect - A shape’s world rect as the router reads it. The one conversion, so a preview’s obstacle set and anything else that builds one cannot disagree about where a block’s edges are.
- override_
rect 🔒 - The previewed geometry for
shapewhen it appears inoverrides(a block or port being dragged or resized), orNoneto use its stored geometry. - override_
slot 🔒 - The previewed slot for
pinwhen a drag previews one. - ride 🔒
- Fold what the gesture has written so far onto a scratch prediction, re-solve against that document, and author every corner list the solve promotes. Trims, re-solves and promotions therefore land in the same commit as the gesture that caused them, and the “every corner is a waypoint” invariant survives without the solver ever writing.
- seeded_
waypoints 🔒 - Where a lattice holds
id’s waypoints this pass: offset with a group drag it rides entirely inside, and without the ones a preview trims or prunes. - seeds_
within 🔒 - Seed points for a lattice covering
within, and no others. - settle_
scope 🔒 - Solve every wire in the scope, for the settling pass that gives a generated document its corners. Not a gesture: there is nothing to scope to, and the point is precisely to touch everything.
- solve_
rider 🔒 - The solve rider: re-solve the wires the gesture disturbed, and author what that promotes into the same commit.
- still_
holds 🔒 - Does a wire’s geometry still run between these anchors without crossing a block? One that does needs no routing, whatever else moved.
Type Aliases§
- Promoted
- What one solve pass promoted: for each wire it touched, the corner list its geometry now implies. The gesture’s funnel diffs these against the staged document and pushes the ones that moved — the solver itself never writes.
- Relaid
Route 🔒 - What a route edit’s commit pushes as ops: the corner list the relayed geometry promotes, and each captured label anchor re-projected onto it.