Skip to main content

settled

Function settled 

Source
pub fn settled(
    frames: &BTreeMap<Id, Rect>,
    moving: &BTreeSet<Id>,
    gap: f64,
    grid: Grid,
) -> BTreeMap<Id, Rect>
Expand description

Settles frames into a layout in which no pair comes closer than gap.

moving names the frames the gesture just authored — the node under the pointer, the group travelling with it, or the node whose editor just grew. When one of those clashes with a resting frame, the moving frame gives way. A moving group that was clear internally stays rigid; malformed input in which two moving frames already clash is still repaired deterministically.

Clear frames are returned byte-for-byte unchanged. A displaced frame moves along one axis to the nearest clear grid position, and is tested against the complete current layout before it is accepted, so resolving one collision never creates another.