MCPcopy
hub / github.com/opentrace/opentrace / createLabel

Method createLabel

ui/src/components/pixi/PixiRenderer.ts:2057–2083  ·  view source on GitHub ↗

Create a label Text for a node. Positioned to the right of the node.

(node: PixiNode)

Source from the content-addressed store, hash-verified

2055
2056 /** Create a label Text for a node. Positioned to the right of the node. */
2057 private createLabel(node: PixiNode): Text {
2058 const lblInv = this.labelInvScale();
2059 const themeColors = getGraphThemeColors();
2060 const label = new Text({
2061 text: cleanLabel(node.graphNode.name || node.id),
2062 style: new TextStyle({
2063 fontSize: LABEL_SIZE,
2064 fontFamily: LABEL_FONT,
2065 fontWeight: 'bold',
2066 fill: themeColors.labelColor,
2067 dropShadow: {
2068 alpha: 0.9,
2069 blur: 3,
2070 color: themeColors.labelShadow,
2071 distance: 0,
2072 },
2073 }),
2074 });
2075 // Anchor left-center, positioned to the right of the node
2076 label.anchor.set(0, 0.5);
2077 const lm = this.labelScaleMultiplier;
2078 label.scale.set(lblInv * lm);
2079 const gap = this.labelGap(node);
2080 label.position.set(node.sprite.position.x + gap, node.sprite.position.y);
2081 this.labelContainer!.addChild(label);
2082 return label;
2083 }
2084
2085 /** Re-cull labels if enough time has passed. For immediate needs (e.g. toggle). */
2086 private throttledLabelCull(): void {

Callers 1

applyLabelCullingMethod · 0.95

Calls 4

labelInvScaleMethod · 0.95
labelGapMethod · 0.95
getGraphThemeColorsFunction · 0.90
cleanLabelFunction · 0.70

Tested by

no test coverage detected