fix(react): expandParent option for child nodes
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
- do not use fallback handle if a specific id is being used
|
- do not use fallback handle if a specific id is being used
|
||||||
- fix `defaultEdgeOptions` markers not being applied
|
- fix `defaultEdgeOptions` markers not being applied
|
||||||
- fix `getNodesBounds` and add second param for passing options
|
- fix `getNodesBounds` and add second param for passing options
|
||||||
|
- fix `expandParent` for child nodes
|
||||||
|
|
||||||
## 12.0.0-next.7
|
## 12.0.0-next.7
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,7 @@ export function handleParentExpand(updatedElements: any[], updateItem: any) {
|
|||||||
for (const [index, item] of updatedElements.entries()) {
|
for (const [index, item] of updatedElements.entries()) {
|
||||||
if (item.id === updateItem.parentNode) {
|
if (item.id === updateItem.parentNode) {
|
||||||
const parent = { ...item };
|
const parent = { ...item };
|
||||||
|
parent.computed ??= {};
|
||||||
if (!parent.computed) {
|
|
||||||
parent.computed = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const extendWidth = updateItem.position.x + updateItem.computed.width - parent.computed.width;
|
const extendWidth = updateItem.position.x + updateItem.computed.width - parent.computed.width;
|
||||||
const extendHeight = updateItem.position.y + updateItem.computed.height - parent.computed.height;
|
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 };
|
const updatedElement = { ...element };
|
||||||
|
|
||||||
for (const change of changes) {
|
for (const change of changes) {
|
||||||
applyChange(change, updatedElement, elements);
|
applyChange(change, updatedElement, updatedElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
updatedElements.push(updatedElement);
|
updatedElements.push(updatedElement);
|
||||||
|
|||||||
Reference in New Issue
Block a user