From b912661779cb47f53c10250e6b33c194b1aa733f Mon Sep 17 00:00:00 2001 From: liuxy0551 Date: Fri, 15 May 2026 17:19:33 +0800 Subject: [PATCH] fix(tinyTag): via getComputedTextLength api to measure svg text element --- src/tinyTag/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tinyTag/index.tsx b/src/tinyTag/index.tsx index 31232d563..7da99c41e 100644 --- a/src/tinyTag/index.tsx +++ b/src/tinyTag/index.tsx @@ -18,7 +18,7 @@ const useSvgWidth = (): UseSvgWidthResult => { const getWidth = useCallback(() => { if (!element) return; const paddingWidth = 8; - const textWidth = Math.round(element.getBoundingClientRect()?.width); + const textWidth = Math.round(element.getComputedTextLength?.() ?? 0); const svgWidth = textWidth + paddingWidth; setSvgWidth(svgWidth); setRectWidth(Math.max(svgWidth - 1, 0));