From 783c0488398a18a2e0cd6d948b4990685d93f516 Mon Sep 17 00:00:00 2001 From: yvonneyx Date: Wed, 27 Nov 2024 14:39:43 +0800 Subject: [PATCH] fix: fallback handling to ignore invisible elements --- packages/g6/src/transforms/place-radial-labels.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/g6/src/transforms/place-radial-labels.ts b/packages/g6/src/transforms/place-radial-labels.ts index a598c5876b6..901eef72e73 100644 --- a/packages/g6/src/transforms/place-radial-labels.ts +++ b/packages/g6/src/transforms/place-radial-labels.ts @@ -54,7 +54,11 @@ export class PlaceRadialLabels extends BaseTransform { const isLeft = Math.abs(radian) > Math.PI / 2; const isLeaf = !datum.children || datum.children.length === 0; - const nodeHalfWidth = parseSize(graph.getElementRenderStyle(idOf(datum)).size)[0] / 2; + const nodeId = idOf(datum); + const node = this.context.element?.getElement(nodeId); + if (!node || !node.isVisible()) return; + + const nodeHalfWidth = parseSize(graph.getElementRenderStyle(nodeId).size)[0] / 2; const offset = (isLeaf ? 1 : -1) * (nodeHalfWidth + this.options.offset); const labelTransform: TransformArray = [