Skip to main content

Module geometry

Module geometry 

Source
Expand description

The geometry family: the emitters that move, resize, and re-slot what already exists, plus the route lists those gestures carry. The gesture solved its own constraints — magnetism, minimum sizes, the re-routed polyline — and hands the result in; the list arithmetic over the indexed document is the emitter’s own.

A keyboard nudge has no emitter of its own: a one-cell arrow delta is move_shape / move_group and a one-slot pin delta is nudge_pins.

Structs§

PinMove
One pin’s destination in a group relocation.
RouteEdit
A finished hand-edit of a wire’s path: the corner list the drag promoted, and each label re-projected onto the geometry that list solves to.
SlotDelta
A whole-slot keyboard shift, negative upward.

Enums§

FlipTarget
What a left/right mirror flips.
Moving
Which rule a move is judged by — the gesture, not the count: a group of one is still a group, and is still exempt from the overlap it already had.
ResizeTarget
What a handle drag resizes. Text boxes are absent: their extent follows their content, so they carry no handles. An icon is named by the block that owns it, as it has no id of its own.
RouteEnd
Which end of a wire rode the move — the side whose approach corners went stale.
Shape
What a drag grabbed. An icon is named by the block that owns it, as it has no id of its own.

Functions§

artwork 🔒
The artwork an icon value holds, or None for the zero icon — the null asset is the “no image” zero, so an empty box must never be written as if it were artwork.
backtracking_ordinals
The corners a backtracking prune drops from the polyline running start → waypoints → end: a 180° kink the wire doubles back on, which strict waypoint routing leaves behind when a corner sits behind its neighbours. Iterative, because dropping one can expose a reversal between its former neighbours; ordinals name the survivors’ original positions, so the preview can route around exactly what the commit would remove. Locks do not protect a corner — a user bend that only makes the wire reverse is still a kink.
carried_icon 🔒
The block’s icon carried by a translation of delta world px.
commit_route_edit
Inventory row “Edit Route (commit)”: the drag’s one document write. The polyline is one atomic value, so the promoted corners land wholesale.
contained_icon 🔒
A block’s icon after a free-pixel drag of its own: shifted, then held inside the block.
flip_pins
Inventory row “Flip Shape Pins”: mirror a shape’s pins left↔right.
flip_vertical
Inventory row “Flip Block Vertical”: mirror a block’s pins top↔bottom about its own slot capacity, keeping each pin’s edge. An exact involution, so a double flip is the identity.
group_move_blocked
The group rule: only a new overlap rejects, so a selection already sitting on its neighbour (a fresh paste) can still be nudged. Intra-group overlaps are ignored — the group keeps its layout.
icon_of 🔒
move_blocked
The single-shape rule: a destination overlapping any other routing shape rejects the move, even one the shape already overlapped.
move_conflicts
The cells a move would have to share with something the router routes around — every overlap that refuses it, not merely that one does.
move_group
Inventory row “Move Group”: one shared snapped delta across a marquee selection — images included, unlike a single move — with the wires the selection touches kept coherent.
move_pin
Inventory row “Move Pin”: drag a pin to another slot or the opposite edge. The slot the drop resolved to arrives decided (the gesture picks between the nearest slot and its neighbour against the live preview); a destination another pin already holds writes nothing.
move_refused
Whether moving shapes by delta would be refused.
move_shape
Inventory row “Move Shape”: drag one shape to a new position. Blocks, ports, text, and areas commit on the grid; artwork — a free-floating image or a block’s icon — moves in free pixels, and an icon is held inside the block it belongs to.
nudge_pins
Inventory row “Nudge Pins”: shift a pin group by whole slots, clamped to the tightest range that keeps every pin on its own block, then relocated as a group.
owned_pins 🔒
owned_pins_ordered 🔒
Owned pins in a stable order, so a rider’s ops read the same on every run (the index’s sets iterate by hash).
place_wire_label
Inventory row “Move Wire Label”: slide a wire’s name label along its route, to the arc length the drag settled on.
placement
The scope a routing shape occupies with its rect: a block sits in its parent’s interior, a port body in its owner’s. Rects only compare within one scope — two scopes are two coordinate spaces.
pruned_waypoints
The polyline with doomed dropped — the prune applied, for the commit that writes it and the preview that previews it.
push_icon 🔒
push_route_riders 🔒
The two waypoint riders a move owes its wires: a route with both endpoints riding keeps its shape, so its corners translate rigidly; one that straddles the move drops its stale approach on the moved side so the re-route rebuilds a clean one. Only wires drawn in a scope the move happened in are reconciled — a moved block’s interior did not move with it, however many of its pins the wires in there land on.
relocate_pins
Inventory row “Relocate Pin Group”: move a multi-pin selection rigidly to new slots. All or nothing — one destination that is taken, out of bounds, or on a frozen interface leaves the whole group where it is.
relocation_fits
Whether every destination is free and in bounds — an all-or-nothing precheck. The group’s own vacated slots count as free, since the movers leave them in the same commit; two movers may not share one.
reroute
Inventory row “Reroute Wire / Block”: drop the user’s corners on route and let the router solve afresh. Under the log the clear and the re-promotion are one write of the solved list; a route the solver left out is the bare clear.
resize
Inventory row “Resize Shape”: the gesture resolved the final rect — minimum sizes, the block-height ladder, aspect snapping, magnetism — and this writes it with the riders it carries: a block’s pins ride up when the new height no longer holds the lowest slot, and its icon rides the center and is held inside the new box.
reverses_at 🔒
Whether the wire reverses direction at cur: the prev → cur and cur → next runs share an axis and point opposite ways. A 90° turn or a straight run through cur is not a reversal.
riding_pins 🔒
The pins that ride a move: a moved block carries its whole boundary, and a moved port is one pin of its own.
scope_shapes 🔒
Every routing shape drawn in scope, with its rect — the obstacle set a move is tested against. The document root is a scope like any other, holding top-level blocks and no ports.
shifted_icon 🔒
Artwork carried by a translation of delta world px.
translate 🔒
The per-kind translation every move shares, collision already decided. grid is the snapped cell delta and px its world-space twin, so the block body and the icon riding it cannot disagree.
trimmed_approach
Port of AutoRoute::approach_waypoint_ids (src/document/auto_route.rs: 162): the polyline minus up to two unlocked corners nearest the moved end, stopping at the first locked one so a hand-placed bend survives.
trimmed_ordinals
The corners trimmed_approach drops, by path ordinal — the same rule read from the preview’s side, which routes around them instead of removing them. A trim is a prefix or a suffix, so the surviving count names the dropped set exactly.