From eca82bd9804136e9f4c034169802351c2274afc8 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Wed, 28 Sep 2022 07:37:07 +0200 Subject: [PATCH] Workaround for FF rendering/bbox race condition --- src/svg/SVGEdge.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/svg/SVGEdge.js b/src/svg/SVGEdge.js index a036bf6..84fd44f 100644 --- a/src/svg/SVGEdge.js +++ b/src/svg/SVGEdge.js @@ -67,15 +67,18 @@ export default class SVGEdge extends EventEmitter { if (label && firstTag) { const text = label.find('text').text(firstTag); - const { width, height } = text[0][0].node.getBBox(); - label.find('rect') + setTimeout(() => { + const { width, height } = text[0][0].node.getBBox(); + + label.find('rect') .attr('x', -5.5) .attr('y', - Math.round(height / 2) - 1.5) .attr('rx', 2) .attr('ry', 2) .attr('width', Math.round(width) + 10) .attr('height', Math.round(height) + 4); + }, 1); label.attr('style', null); } else {