feat(nested-nodes): simplify nested node rendering
This commit is contained in:
+10
-5
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user