fix(expandParent): check for dimensions closes #2280
This commit is contained in:
@@ -91,6 +91,7 @@ const initialNodes: Node[] = [
|
|||||||
position: { x: 225, y: 50 },
|
position: { x: 225, y: 50 },
|
||||||
className: 'light',
|
className: 'light',
|
||||||
parentNode: '5',
|
parentNode: '5',
|
||||||
|
expandParent: true,
|
||||||
},
|
},
|
||||||
{ id: '2', data: { label: 'Node 2' }, position: { x: 100, y: 100 }, className: 'light' },
|
{ id: '2', data: { label: 'Node 2' }, position: { x: 100, y: 100 }, className: 'light' },
|
||||||
{ id: '3', data: { label: 'Node 3' }, position: { x: 400, y: 100 }, className: 'light' },
|
{ id: '3', data: { label: 'Node 3' }, position: { x: 400, y: 100 }, className: 'light' },
|
||||||
|
|||||||
@@ -10,17 +10,14 @@ function handleParentExpand(res: any[], updateItem: any) {
|
|||||||
if (extendWidth > 0 || extendHeight > 0 || updateItem.position.x < 0 || updateItem.position.y < 0) {
|
if (extendWidth > 0 || extendHeight > 0 || updateItem.position.x < 0 || updateItem.position.y < 0) {
|
||||||
parent.style = { ...parent.style } || {};
|
parent.style = { ...parent.style } || {};
|
||||||
|
|
||||||
|
parent.style.width = parent.style.width ?? parent.width;
|
||||||
|
parent.style.height = parent.style.height ?? parent.height;
|
||||||
|
|
||||||
if (extendWidth > 0) {
|
if (extendWidth > 0) {
|
||||||
if (!parent.style.width) {
|
|
||||||
parent.style.width = parent.width;
|
|
||||||
}
|
|
||||||
parent.style.width += extendWidth;
|
parent.style.width += extendWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extendHeight > 0) {
|
if (extendHeight > 0) {
|
||||||
if (!parent.style.height) {
|
|
||||||
parent.style.height = parent.height;
|
|
||||||
}
|
|
||||||
parent.style.height += extendHeight;
|
parent.style.height += extendHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user