Skip to main content

Module presentation

Module presentation 

Source
Expand description

How the document actually appears on the canvas: where wires run (solved route geometry), how big text really is (measured extents), what color pin stubs show (accents propagated from route roles). Everything here is computed from the authored document and lives beside it — never authored, never undone, never persisted.

Owned by the app for the life of a session and threaded through Drawing like the spatial index, mutably, because the passes that fill it run inside Drawing methods. Each part is gated on the document’s own stamp, so a commit that landed anywhere — local, foreign, or an undo — re-derives it on the next borrow and nothing has to remember to invalidate it. A live preview is the one writer that does not follow the document: it previews geometry and says so (Presentation::routes_previewed), which is what takes an abandoned drag’s preview back.

Re-exports§

pub use route::Crossing;
pub use route::LocAndDirection;
pub use route::RouteDirection;
pub use route::RouteEdge;
pub use route::RouteGeometry;

Modules§

route
Solved wire geometry: what the router produced for one route — its edge polyline, resolved endpoints, and crossing hops. Authored route state (anchors, waypoints, labels, name, role) stays on the document’s own Route; everything here is recomputable and never persisted.
store
EdgeId and the insertion-ordered map keyed by it. EdgeId is presentation’s own: the router never persists edge identity, so nothing outside this module allocates one.

Structs§

PinAccents
Route-role propagation onto pin stubs: a wire’s accent colors the pins it lands on. Derived fresh from the routes on every borrow — the last route at a scope to touch a pin wins, including a plain (None) role — so it cannot go stale the way a stored propagation would.
Presentation
ShapeAccents
The accent lookup for the pins of one shape, resolved by a caller that knows which scope the shape is being drawn in.
TextExtents
Galley-measured text-box extents, keyed by the text and the width they were measured for: an entry is consulted only while the box still holds that text at that width, so the cache can never serve a stale rect — undo, load, or restore leave it self-invalidated and readers fall back to the character-count estimate until the box is next measured.

Type Aliases§

RouteGeometries
Solved geometry per route. Flat rather than keyed by scope: route ids are document-wide unique, so a scope key would distinguish nothing.