Skip to content
sigma.js sigma.js
v4.0.6 Docs Examples GitHub 12.2K

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.

number

number

number

number

number