diagram_core/src/layout/adjust.rs#
Source: lib/diagram_core/src/layout/adjust.rs
layout/adjust -- (JD21) small adjustments of connected shapes: Automatische Ausrichtung und
Abstände and Automatischer Abstand (CN-14, RS-25), Diagramm drehen (RS-25), Von
Seitenumbrüchen verschieben and Seitenumbrüche vermeiden (PR-03); the rules in layout.rs
align_space(doc, owner, only, align, space, spacing) -> moves each child (downstream over
a connector) lined up with its parent and set at the spacing from it,
its siblings on that side at the spacing from each other, everything
further downstream carried along
turn(doc, owner, only, Turn, spacing) -> moves each connected part (a selection: one)
turned or flipped about the middle of its box, the shapes upright;
distances grow where shapes would come too close
off_breaks(doc, owner, only, &xs, &ys, margin) -> moves shapes across a page break
moved to the side where more of them lies, `margin` from the break
The moves are applied with layout::move_nodes (members and callouts along) and the
connectors follow with layout::reroute, all in the caller's transaction.
fn align_space(doc: &Document, owner: Owner, only: &[ShapeRef], align: bool, space: bool, spacing: [f64; 2]) -> Vec<(ShapeRef, [f64; 2])>Automatische Ausrichtung und Abstände (alignandspace), Automatischer Abstand (spacealone), automatisch ausrichten (alignalone) on the connected shapes ofowner(onlynot empty: the selected ones adjust, what lies downstream of them is carried along) -> the moves of the shapes (see the file header)enum TurnDiagramm drehen: VisLayoutDirection's four (0 right, 1 left, 2 vertical, 3 horizontal)Right-- 90 degrees clockwiseLeft-- 90 degrees anticlockwiseFlipV-- top and bottom exchangedFlipH-- left and right exchanged
fn turn(doc: &Document, owner: Owner, only: &[ShapeRef], how: Turn, spacing: [f64; 2]) -> Vec<(ShapeRef, [f64; 2])>Diagramm drehen: every connected part of two or more shapes ofowner(onlynot empty: the selected shapes as one part) turned or flipped about the middle of its box; the shapes keep their own orientation, fixed ones stay; after a turn the distances along an axis grow where two shapes would come closer thanspacingon both axes -> the movesfn off_breaks(doc: &Document, owner: Owner, only: &[ShapeRef], xs: &[f64], ys: &[f64], margin: f64) -> Vec<(ShapeRef, [f64; 2])>Von Seitenumbrüchen verschieben: the shapes ofowner(onlynot empty: those; members move with their containers, fixed shapes stay) that lie across a page break (xs: the vertical lines,ys: the horizontal ones, drawing units) moved to the side where more of them lies,marginfrom the break -> the moves