From afe024900cadc1dd40be45dae314ff38e1ff6475 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sat, 7 Jan 2023 17:54:06 +0100 Subject: [PATCH] refactor(core): only apply new positions if there are changes Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- packages/core/src/components/Nodes/NodeWrapper.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core/src/components/Nodes/NodeWrapper.vue b/packages/core/src/components/Nodes/NodeWrapper.vue index f81768e9..39b0eab8 100644 --- a/packages/core/src/components/Nodes/NodeWrapper.vue +++ b/packages/core/src/components/Nodes/NodeWrapper.vue @@ -156,8 +156,14 @@ until(() => node.initialized) function updatePosition() { const { computedPosition, position } = calcNextPosition(node, node.computedPosition, nodeExtent, parentNode) - node.computedPosition = { ...node.computedPosition, ...computedPosition } - node.position = position + // only overwrite positions if there are changes when clamping + if (node.computedPosition.x !== computedPosition.x || node.computedPosition.y !== computedPosition.y) { + node.computedPosition = { ...node.computedPosition, ...computedPosition } + } + + if (node.position.x !== position.x || node.position.y !== position.y) { + node.position = position + } } function updateInternals() {