Skip to content

Commit 7d66094

Browse files
committed
fix(nodes): check parent dimensions before extending
1 parent 480a487 commit 7d66094

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/vue-flow/src/utils/changes.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ function handleParentExpand(updateItem: GraphNode, parent: GraphNode) {
2525
if (extendWidth > 0 || extendHeight > 0 || updateItem.position.x < 0 || updateItem.position.y < 0) {
2626
parent.style = { ...parent.style } || {}
2727

28+
parent.style.width = parent.style.width ?? parent.dimensions.width
29+
parent.style.height = parent.style.height ?? parent.dimensions.height
30+
2831
if (extendWidth > 0) {
29-
if (!parent.style.width) {
30-
parent.style.width = parent.dimensions.width
31-
}
3232
if (typeof parent.style.width === 'string') {
3333
const currWidth = parseInt(parent.style.width, 10)
3434
parent.style.width = `${currWidth + extendWidth}px`
@@ -38,9 +38,6 @@ function handleParentExpand(updateItem: GraphNode, parent: GraphNode) {
3838
}
3939

4040
if (extendHeight > 0) {
41-
if (!parent.style.height) {
42-
parent.style.height = parent.dimensions.height
43-
}
4441
if (typeof parent.style.height === 'string') {
4542
const currWidth = parseInt(parent.style.height, 10)
4643
parent.style.height = `${currWidth + extendHeight}px`

0 commit comments

Comments
 (0)