fix(react): expandParent option for child nodes

This commit is contained in:
moklick
2024-01-25 21:13:06 +01:00
parent 19bcfe28a2
commit a027b26f11
2 changed files with 3 additions and 5 deletions
+1
View File
@@ -9,6 +9,7 @@
- do not use fallback handle if a specific id is being used
- fix `defaultEdgeOptions` markers not being applied
- fix `getNodesBounds` and add second param for passing options
- fix `expandParent` for child nodes
## 12.0.0-next.7
+2 -5
View File
@@ -6,10 +6,7 @@ export function handleParentExpand(updatedElements: any[], updateItem: any) {
for (const [index, item] of updatedElements.entries()) {
if (item.id === updateItem.parentNode) {
const parent = { ...item };
if (!parent.computed) {
parent.computed = {};
}
parent.computed ??= {};
const extendWidth = updateItem.position.x + updateItem.computed.width - parent.computed.width;
const extendHeight = updateItem.position.y + updateItem.computed.height - parent.computed.height;
@@ -106,7 +103,7 @@ function applyChanges(changes: any[], elements: any[]): any[] {
const updatedElement = { ...element };
for (const change of changes) {
applyChange(change, updatedElement, elements);
applyChange(change, updatedElement, updatedElements);
}
updatedElements.push(updatedElement);