Skip to main content

Module drawing

Module drawing 

Source
Expand description

Drawing: the editing surface for one level of the document.

This module holds the view itself — construction, the per-kind accessors that add, read, and edit shapes, deletion, and the broad-phase candidate queries. The rest of the surface lives in sibling modules, each carrying its own impl Drawing block:

  • hit_target — what sits at a point, in z-order.
  • clipboard — copy, cut, and paste.
  • routing — solving and re-solving a level’s wires.
  • movement — moving shapes and the routes that follow.

Structs§

Conflicts 🔒
What Drawing::standing_conflicts marks, in world space.
Drawing
A transient view onto one scope of the document. Reads project the scope’s entities out of indexed; writes are emitted into sink and only become document state when the gesture seals and submits.
Hops
The hops a pass’s wires draw, from Drawing::hops.
LabelPlacement
A committed title/type-label placement: the resolved offset (world px — grid-rounded and clamped by the caller, who owns the text metrics) and the side the release height chose, when it chose one.
Previewed 🔒
What a preview draws this frame that the document does not hold: shapes at hypothetical rects, and the routes re-solved against them. The cull set and the conflict pass read it — the spatial index holds committed rects, so a shape whose committed rect is off screen must still draw when its preview is on screen, and is marked where it is dragged — and a Drawing is one frame, so a preview cannot outlive the frame that made it.

Constants§

SETTLING_PASSES 🔒
How many solves a document may take to stop moving its corners.

Functions§

delete_target 🔒
is_routing 🔒
Whether wires route around id: the blocks and the ports.
present_document 🔒
reconstruct_scope 🔒
Prepare the whole document to be looked at: turn what the document authors into what the canvas shows.
settle_corners
document with every wire’s corners stored as the solve leaves them once it has nothing more to promote — what the solve rider converges on over a document’s seals, and so what one the editor saved carries. A single solve is not enough: corners promoted from a bare wire re-solve differently from the wire they came from.
settling_pass 🔒
One solve of every wired level, as the commit its promoted corners make. None when it promotes nothing new.
shape_layer_rank 🔒
Paint-layer precedence of a shape, matching Drawing::shapes order (blocks, ports, texts, images) with areas last. Paired with the entity’s write order it reproduces that walk exactly, which is how the index-limited candidate list and the linear scan stay one order.
slot_at 🔒
The slot a boundary offset in world pixels names.
title_target 🔒
The entity a shape names to the delete cascade. An icon has none — it is a value on its block, not an entity, so it is zeroed rather than deleted.
wired_scopes 🔒
Every level that holds wires, as the path a drawing of it opens on.