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

GLSL_GET_LABEL_DIRECTION

const GLSL_GET_LABEL_DIRECTION: “\nvec2 getLabelDirection(float positionMode) {\n if (positionMode < 0.5) return vec2(1.0, 0.0); // Right\n if (positionMode < 1.5) return vec2(-1.0, 0.0); // Left\n if (positionMode < 2.5) return vec2(0.0, -1.0); // Above\n if (positionMode < 3.5) return vec2(0.0, 1.0); // Below\n return vec2(0.0); // Over (centered)\n}\n”

Defined in: packages/sigma/src/rendering/glsl.ts:53

Get screen-space direction for label position mode. Maps position mode (0-4) to direction vectors. Directions use screen coordinates (Y-down).

Position modes: 0: right → (1, 0) 1: left → (-1, 0) 2: above → (0, -1) 3: below → (0, 1) 4: over → (0, 0)