From 7d66094b06a94b6894fc6cb98d136175a23cca34 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 18 Jul 2022 13:44:35 +0200 Subject: [PATCH] fix(nodes): check parent dimensions before extending --- packages/vue-flow/src/utils/changes.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/vue-flow/src/utils/changes.ts b/packages/vue-flow/src/utils/changes.ts index 9b06eb16..86e03c38 100644 --- a/packages/vue-flow/src/utils/changes.ts +++ b/packages/vue-flow/src/utils/changes.ts @@ -25,10 +25,10 @@ function handleParentExpand(updateItem: GraphNode, parent: GraphNode) { if (extendWidth > 0 || extendHeight > 0 || updateItem.position.x < 0 || updateItem.position.y < 0) { parent.style = { ...parent.style } || {} + parent.style.width = parent.style.width ?? parent.dimensions.width + parent.style.height = parent.style.height ?? parent.dimensions.height + if (extendWidth > 0) { - if (!parent.style.width) { - parent.style.width = parent.dimensions.width - } if (typeof parent.style.width === 'string') { const currWidth = parseInt(parent.style.width, 10) parent.style.width = `${currWidth + extendWidth}px` @@ -38,9 +38,6 @@ function handleParentExpand(updateItem: GraphNode, parent: GraphNode) { } if (extendHeight > 0) { - if (!parent.style.height) { - parent.style.height = parent.dimensions.height - } if (typeof parent.style.height === 'string') { const currWidth = parseInt(parent.style.height, 10) parent.style.height = `${currWidth + extendHeight}px`