From 94344a6d4258696fefd516c43030e8c8685255e6 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Wed, 4 Jan 2023 13:46:28 +0100 Subject: [PATCH] fix(core): reapply node extent on change Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- .../core/src/components/Nodes/NodeWrapper.vue | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/core/src/components/Nodes/NodeWrapper.vue b/packages/core/src/components/Nodes/NodeWrapper.vue index 6d73dc81..94190ad9 100644 --- a/packages/core/src/components/Nodes/NodeWrapper.vue +++ b/packages/core/src/components/Nodes/NodeWrapper.vue @@ -131,6 +131,20 @@ watch( { flush: 'pre', immediate: true }, ) +watch([() => node.extent, () => nodeExtent], () => { + const { position } = calcNextPosition(node, node.computedPosition, nodeExtent, parentNode) + + node.computedPosition = { ...node.computedPosition, ...position } +}) + +until(() => node.initialized) + .toBe(true) + .then(() => { + const { position } = calcNextPosition(node, node.computedPosition, nodeExtent, parentNode) + + node.computedPosition = { ...node.computedPosition, ...position } + }) + function updatePosition(nodePos: XYZPosition, parentPos?: XYZPosition) { let nextPos = nodePos @@ -141,14 +155,6 @@ function updatePosition(nodePos: XYZPosition, parentPos?: XYZPosition) { node.computedPosition = nextPos } -until(() => node.initialized) - .toBe(true) - .then(() => { - const { position } = calcNextPosition(node, node.computedPosition, nodeExtent, parentNode) - - node.computedPosition = { ...node.computedPosition, ...position } - }) - function updateInternals() { if (nodeElement.value) updateNodeDimensions([{ id, nodeElement: nodeElement.value, forceUpdate: true }])