feat(nested-nodes): simplify nested node rendering

This commit is contained in:
Christopher Möller
2021-10-27 15:38:29 +02:00
parent 3e0b673e90
commit 241f604125
7 changed files with 47 additions and 65 deletions
+10 -5
View File
@@ -301,17 +301,22 @@ function applyChanges(changes: NodeChange[] | EdgeChange[], elements: any[]): an
if (currentChange) {
switch (currentChange.type) {
case 'dimensions': {
res.push({ ...item, ...currentChange.dimensions, handleBounds: currentChange.handleBounds });
return res;
}
case 'select': {
res.push({ ...item, isSelected: currentChange.isSelected });
return res;
}
case 'position': {
case 'dimensions': {
const updateItem = { ...item };
if (typeof currentChange.dimensions !== 'undefined') {
updateItem.width = currentChange.dimensions.width;
updateItem.height = currentChange.dimensions.height;
}
if (typeof currentChange.handleBounds !== 'undefined') {
updateItem.handleBounds = currentChange.handleBounds;
}
if (typeof currentChange.position !== 'undefined') {
updateItem.position = currentChange.position;
}