From 6784fbaf511a33daccab7ff15d93664a5641588b Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Mon, 22 Aug 2022 08:42:11 -0500 Subject: [PATCH] Update node bounds whenever a node is registered or unregistered --- src/components/Context.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/Context.vue b/src/components/Context.vue index d752460..33cbf2b 100644 --- a/src/components/Context.vue +++ b/src/components/Context.vue @@ -56,13 +56,12 @@ provide(RegisterNodeInjectionKey, (id, element) => { const observer = new MutationObserver(() => updateNode(id)); observer.observe(element, observerOptions); nodes.value[id] = { element, observer, rect: element.getBoundingClientRect() }; - emit("updateNodes", nodes.value); - nextTick(() => updateNode(id)); + updateBounds(); }); provide(UnregisterNodeInjectionKey, id => { nodes.value[id]?.observer.disconnect(); nodes.value[id] = undefined; - emit("updateNodes", nodes.value); + updateBounds(); }); provide(NodesInjectionKey, nodes); provide(BoundsInjectionKey, boundingRect);