refactor(react/changes): handle resize

This commit is contained in:
moklick
2024-01-11 10:27:07 +01:00
parent bff944e29a
commit f4def7d6c1
3 changed files with 6 additions and 4 deletions

View File

@@ -63,6 +63,7 @@ const CustomNodeFlow = () => {
onEdgesChange={onEdgesChange}
onConnect={onConnect}
fitView
className="multiset"
>
<Controls />
<Background />

View File

@@ -1,3 +1,3 @@
.react-flow .react-flow__node {
.multiset .react-flow__node {
width: 50px;
}

View File

@@ -152,10 +152,11 @@ function applyChange(change: any, element: any, elements: any[] = []): any {
element.computed ??= {};
element.computed.width = change.dimensions.width;
element.computed.height = change.dimensions.height;
}
if (typeof change.updateStyle !== 'undefined') {
element.style = Object.assign({}, element.style, change.updateStyle);
if (change.resizing) {
element.width = change.dimensions.width;
element.height = change.dimensions.height;
}
}
if (typeof change.resizing === 'boolean') {