GLSL_LABEL_BOX_CENTER
constGLSL_LABEL_BOX_CENTER: “\nvec2 labelBoxCenter(float positionMode, float labelStart, vec2 halfSize, float textHalfY) {\n if (positionMode < 0.5) return vec2(labelStart + halfSize.x, 0.0); // right\n if (positionMode < 1.5) return vec2(-(labelStart + halfSize.x), 0.0); // left\n if (positionMode < 2.5) return vec2(0.0, -(labelStart + textHalfY)); // above\n if (positionMode < 3.5) return vec2(0.0, labelStart + textHalfY); // below\n return vec2(0.0); // over\n}\n”
Defined in: packages/sigma/src/rendering/glsl.ts:137
Center of the label box relative to the node center, in screen pixels (Y-down), BEFORE the label-angle rotation is applied.
Shared by the label-background and attachment shaders to place the box around the (frame-texture) edge distance, so they stay in lockstep with the label.
positionMode: 0=right 1=left 2=above 3=below 4=over labelStart: distance from the node center to the box’s inner edge along the position direction (= shape edge distance + margin) halfSize: half the label box extent (text half-width/height, px) textHalfY: half the actual glyph height (maxAscent+maxDescent). For above/below the box centers on the text, not the font line box, so it stays aligned with the rendered glyphs.