refactor(types): add NodePositionChange type

This commit is contained in:
moklick
2022-01-25 13:54:33 +01:00
parent 2a4dfce61c
commit 067d681485
4 changed files with 27 additions and 15 deletions
+12 -6
View File
@@ -12,14 +12,9 @@ function applyChanges(changes: NodeChange[] | EdgeChange[], elements: any[]): an
res.push({ ...item, selected: currentChange.selected });
return res;
}
case 'dimensions': {
case 'position': {
const updateItem = { ...item };
if (typeof currentChange.dimensions !== 'undefined') {
updateItem.width = currentChange.dimensions.width;
updateItem.height = currentChange.dimensions.height;
}
if (typeof currentChange.position !== 'undefined') {
updateItem.position = currentChange.position;
}
@@ -69,6 +64,17 @@ function applyChanges(changes: NodeChange[] | EdgeChange[], elements: any[]): an
res.push(updateItem);
return res;
}
case 'dimensions': {
const updateItem = { ...item };
if (typeof currentChange.dimensions !== 'undefined') {
updateItem.width = currentChange.dimensions.width;
updateItem.height = currentChange.dimensions.height;
}
res.push(updateItem);
return res;
}
case 'remove': {
return res;
}