diagram_core/src/structure/edge.rs#
Source: lib/diagram_core/src/structure/edge.rs
structure::edge -- (JD21, ST-03) boundary members: shapes that sit on a container's edge (tabs on
a panel), stay on it and go with it
REL_LEFT, REL_RIGHT, REL_TOP, REL_BOTTOM the Relationships types 7 .. 10 (the member names
the container whose left / right / top / bottom edge it
sits on; learn.microsoft.com "Relationships Cell")
edge_of(doc, s, c) -> Option<Edge> the edge of container c that member s sits on
boundary_members(doc, c) the members of c on its edges
straddles(doc, c, s) -> Option<Edge> the edge of c shape s lies across where it is now
targets(doc, owner, s, moving) the containers whose edge s lies across (and that take it)
align(tx, eng, c) -> moved every boundary member back onto its edge
Visio (belegt: Visio team blog "Details on Container Behaviors", 2009): "To put a shape on the
boundary of a container, simply drag it there"; boundary shapes stay members (types 1 and 4 as
any member) "but they behave differently during resize actions": "it will move with that
boundary"; the highlight shows along the one edge. Angenommen (the Gegenprobe checks): a 2-D
shape is on an edge when the edge's line runs through its box (not wholly inside nor outside)
and its middle lies within the edge's length, the nearest edge wins at a corner; it then sits
with its middle on the edge's line (dropped there it is put onto it), slides along the edge and
stays within its ends; a plain member moved partly out stays a plain member (the container
grows, JD10) -- only a shape that comes from outside or sits on an edge already takes one;
boundary members do not count for the container's automatic size; only
upright containers have boundary members; the container side names them as members (type 1)
only, the member side has type 4 and its edge type.
/// the member names the container whose left edge it sits on
REL_LEFT: u32 = 7
/// ... right edge
REL_RIGHT: u32 = 8
/// ... top edge
REL_TOP: u32 = 9
/// ... bottom edge
REL_BOTTOM: u32 = 10
fn rel_of(e: Edge) -> Option<u32>the type of an edgefn edge_of(doc: &Document, s: ShapeRef, c: ShapeRef) -> Option<Edge>the edge of containercthat memberssits on (its Relationships, types 7 .. 10)fn boundary_members(doc: &Document, c: ShapeRef) -> Vec<(ShapeRef, Edge)>the members ofcthat sit on one of its edgesfn straddles(doc: &Document, c: ShapeRef, s: ShapeRef) -> Option<Edge>the edge of containercwhose line runs through the box ofswith the middle ofswithin the edge's length (the nearest one at a corner); None: no edge, orcis turnedfn targets(doc: &Document, owner: Owner, s: ShapeRef, moving: &[ShapeRef]) -> Vec<(ShapeRef, Edge)>the containers onowner(not amongmoving) whose edge shapeslies across, that take it and are not locked, with the edgefn align(tx: &mut Transaction, eng: &mut Engine, c: ShapeRef) -> Result<Vec<ShapeRef>, EditError>every boundary member ofcback onto its edge: its middle on the edge's line, within the edge's length -> the members moved (with what they carry)