From 3e11a3126fb86d66896a09803da56e56bdf279f8 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Wed, 18 Jan 2023 18:13:49 +0100 Subject: [PATCH] chore(core): rename `updatePosition` to `clampPosition` Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- packages/core/src/components/Nodes/NodeWrapper.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/components/Nodes/NodeWrapper.vue b/packages/core/src/components/Nodes/NodeWrapper.vue index eb568818..51ae5c5f 100644 --- a/packages/core/src/components/Nodes/NodeWrapper.vue +++ b/packages/core/src/components/Nodes/NodeWrapper.vue @@ -142,7 +142,7 @@ watch([() => node.extent, () => nodeExtent], ([nodeExtent, globalExtent], [oldNo // update position if extent has actually changed if (nodeExtent !== oldNodeExtent || globalExtent !== oldGlobalExtent) { // todo: can we solve this without a timeout? Without the timeout the initial extent is not properly calculated - setTimeout(updatePosition, 1) + setTimeout(clampPosition, 1) } }) @@ -150,13 +150,13 @@ watch([() => node.extent, () => nodeExtent], ([nodeExtent, globalExtent], [oldNo if (node.extent === 'parent' || typeof node.extent === 'object') { until(() => node.initialized) .toBe(true) - .then(updatePosition) + .then(clampPosition) } else { - updatePosition() + clampPosition() } /** this re-calculates the current position, necessary for clamping by a node's extent */ -function updatePosition() { +function clampPosition() { const { computedPosition, position } = calcNextPosition(node, node.computedPosition, nodeExtent, parentNode) // only overwrite positions if there are changes when clamping