Skip to content
This is the alpha v4 version website. Looking for the v3 documentation?

getCorrectionRatio

getCorrectionRatio(viewportDimensions, graphDimensions): number

Defined in: packages/sigma/src/utils/coordinates.ts:12

In sigma, the graph is normalized into a [0, 1], [0, 1] square, before being given to the various renderers. This helps to deal with quadtree in particular. But at some point, we need to rescale it so that it takes the best place in the screen, i.e. we always want to see two nodes “touching” opposite sides of the graph, with the camera being at its default state.

This function determines this ratio.

Parameters

viewportDimensions

height

number

width

number

graphDimensions

height

number

width

number

Returns

number