refactor(nodes): handle type changes #545

This commit is contained in:
moklick
2020-10-05 12:14:22 +02:00
parent 787f8e1e25
commit c4e4f76a2b
3 changed files with 64 additions and 0 deletions
+7
View File
@@ -44,6 +44,13 @@ const useElementUpdater = (propElements: Elements): void => {
if (typeof propElement.type !== 'undefined') {
elementProps.type = propElement.type;
// we reset the elements dimensions here in order to force a re-calculation of the bounds.
// When the type of a node changes it is possible that the number or positions of handles changes too.
if (isNode(existingElement) && propElement.type !== existingElement.type) {
existingElement.__rf.width = null;
existingElement.__rf.height = null;
}
}
if (isNode(existingElement)) {