Skip to content

@graphty/layout / utils/rescale / rescaleLayoutDict

Function: rescaleLayoutDict() ​

rescaleLayoutDict(pos, scale?): PositionMap

Defined in: utils/rescale.ts:191

Return a dictionary of scaled positions centered at (0, 0).

Parameters ​

pos ​

PositionMap

Dictionary of positions

scale? ​

number = 1

Scale factor for positions

Returns ​

PositionMap

Dictionary of scaled positions

Deprecated ​

Use rescaleInPlace(positions, dim, scale) over a flat dim-stride array. For a plain id-keyed map, copy its rows into a Float64Array, rescale it and write the rows back. For the map of a layout run over a graph snapshot, fromPositionMap(pos, snapshot.ids, dim, fill) builds the array and toPositionMap({ positions, dim, n }, snapshot.ids) reads it back; both need the snapshot's NodeIdMap, and fromPositionMap builds a Float32Array, so values lose f64 precision. rescaleInPlace skips a NaN component in the mean and the distance where this function lets it spread, and it returns dim components per row whatever the length of center; toPositionMap also drops a row whose every component is NaN. Removed in 3.0.0.