Skip to content
D
Documentation

DetachedParentAnchor

reference
1 min readUpdated

Import it from @grafloria/engine.

The LAST-KNOWN ANCHOR of a node the diagram has REMOVED.

A removed parent leaves soft refs behind by design (children's parentId, group members) — hard-clearing them would be irreversible under collab/undo, where the ref dangling and later RE-RESOLVING is exactly what makes undo-of-parent-delete restore children byte-identically (same argument as the link quarantine in collab/integrity.ts). The price of keeping the ref is that the position readers must TOLERATE it: without help, a relative child whose parent stopped resolving read its raw offset as world coordinates and visually JUMPED. This anchor is the help — everything the three parent frame readers (getWorldPosition / getGlobalPosition / getGlobalTransformMatrix) need to freeze an orphaned subtree exactly where the user last saw it. Captured by DiagramModel.removeNode() at the moment of removal; DERIVED, session-local, never serialized (a document loaded with a dangle has no anchor to freeze at — that is DiagramValidator's case, and the readers keep their deterministic raw-offset fallback).

ts
interface DetachedParentAnchor

Properties

NameTypeDefaultDescription
worldPointgetWorldPosition() at removal — the summed offset chain, world coords.
globalPointgetGlobalPosition() at removal — the transform-aware position.
rotationnumberLocal rotation at removal (getGlobalPosition composes against the parent's LOCAL rotation).
scalePointLocal scale at removal (same reason).
matrixTransformMatrixgetGlobalTransformMatrix() at removal — for getGlobalBounds and friends.

Was this page helpful?

DetachedParentAnchor — Grafloria