From 008929a939237252a2678a91ab4777233f6d3122 Mon Sep 17 00:00:00 2001 From: bcakmakoglu <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 27 May 2022 22:44:32 +0200 Subject: [PATCH] fix(edges): use correct bbox for edge text --- .../vue-flow/src/components/Edges/EdgeText.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/vue-flow/src/components/Edges/EdgeText.vue b/packages/vue-flow/src/components/Edges/EdgeText.vue index c24afa04..da06723e 100644 --- a/packages/vue-flow/src/components/Edges/EdgeText.vue +++ b/packages/vue-flow/src/components/Edges/EdgeText.vue @@ -15,9 +15,13 @@ const { const edgeRef = templateRef('el', null) -const { width, height } = $(useElementBounding(edgeRef)) +let box = $ref({ x: 0, y: 0, width: 0, height: 0 }) -const transform = computed(() => `translate(${x - width / 2} ${y - height / 2})`) +onMounted(() => { + box = edgeRef.value.getBBox() +}) + +const transform = computed(() => `translate(${x - box.width / 2} ${y - box.height / 2})`)