rune-langium / visual-editor/src / computeLayoutIncremental
Function: computeLayoutIncremental()
ts
function computeLayoutIncremental(
nodes,
edges,
options?): TypeGraphNode[];Defined in: packages/visual-editor/src/layout/dagre-layout.ts:153
Compute layout with cache-first strategy.
For incremental visibility changes (toggling a single namespace), nodes with cached positions reuse them. Only nodes without cached positions trigger a full dagre run.
When the ratio of uncached nodes is small (<30%), we place cached nodes at their old positions and only run dagre for the new ones, offsetting them near related cached nodes.
When the ratio is large (>=30%), we run a full dagre layout and update the cache.
Parameters
| Parameter | Type |
|---|---|
nodes | TypeGraphNode[] |
edges | TypeGraphEdge[] |
options? | LayoutOptions |