layout

layout.scale

scale(factor: number | object, nodeIds?: string[]): Promise<void>

Scale node positions by the given factor, relative to their centroid.

Pass a scalar to scale uniformly; pass an { x, y, z? } object for per-axis scaling.

Recorded in history as "SetPositions" or "DragPositions". Emits "layout:start" and "layout:end".

factornumber | objectUniform scale factor or per-axis { x, y, z? } multipliers.
nodeIdsstring[]Subset of nodes to scale; defaults to all nodes.

Returns: Promise<void>

Example

await api.layout.scale(2);                        // expand uniformly
await api.layout.scale({ x: 2, y: 0.5 });        // stretch x, compress y