Expand description
Seat-based ports: discrete connection points packed around a node’s rounded rim, and the curves between them.
This is an alternative to crate::Handle-based anchoring for editors
where connections may attach anywhere on a node’s border: a rim offers a
whole number of seats one SEAT_PITCH apart, solve_ports packs
every connection end into a seat of its own (deterministically, so the
same graph always renders the same), and edge_geometry draws the
curve between two seats, arrowheads and label anchor included.
Everything here is headless — pure geometry over keyed rectangles — so it can drive custom edge layers, exports and thumbnails alike.
Structs§
- Anchor
- Arrows
- Which ends of a connection carry an arrowhead. The plane only needs to know which ends to leave room for; what an arrow means belongs to the application.
- Edge
Anchors - Edge
Geometry - Link
- Port
Seat - One of the discrete places on a node’s rim where a bead may rest.
Enums§
- Endpoint
- Side
- Re-exported for convenience: a seat names its face with the shared
Sidetype. A side of a node, used for handle placement, seat naming and edge routing. - Terminal
Constants§
- CORNER_
RADIUS - How rounded a node’s corners are. The stylesheet has to agree with this, or beads will sit off the rim they are packed onto.
- DEFAULT_
LABEL_ POSITION - Where a label rests until it is moved.
- MAX_
LABEL_ POSITION - MIN_
LABEL_ POSITION - How near a connection’s end a label may be dragged. A label exactly on the end would sit under the arrowhead and the node both.
- PORT_
RADIUS - The bead’s own radius, which the surface draws and this reserves room for.
- SEAT_
PITCH - How far apart the seats on a node’s rim are, and so the least room any two beads can have between them.
Functions§
- clamp_
seat - The nearest seat this frame actually has to the one asked for. A node shrunk past one of its own ports leaves that port at the corner rather than off the end of the rim.
- edge_
geometry - nearest_
free_ seat - The seat nearest a point that nothing is sitting in yet.
- nearest_
on_ ring - nearest_
seat - The seat nearest a point, which is what a dragged bead lands on.
- ring_
length - ring_
point - seat_
point - Where a seat sits on the rim, with the outward normal a connection leaves along. The seat names a point on the plain rectangle; the rim itself is rounded, so a corner seat resolves onto its arc.
- seats
- Every seat a frame offers, walking the rim clockwise from the top-left corner. The four corners belong to the horizontal runs, so no place on the rim is named twice.
- solve_
ports