refactor(react/changes): handle resize
This commit is contained in:
@@ -63,6 +63,7 @@ const CustomNodeFlow = () => {
|
|||||||
onEdgesChange={onEdgesChange}
|
onEdgesChange={onEdgesChange}
|
||||||
onConnect={onConnect}
|
onConnect={onConnect}
|
||||||
fitView
|
fitView
|
||||||
|
className="multiset"
|
||||||
>
|
>
|
||||||
<Controls />
|
<Controls />
|
||||||
<Background />
|
<Background />
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
.react-flow .react-flow__node {
|
.multiset .react-flow__node {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,10 +152,11 @@ function applyChange(change: any, element: any, elements: any[] = []): any {
|
|||||||
element.computed ??= {};
|
element.computed ??= {};
|
||||||
element.computed.width = change.dimensions.width;
|
element.computed.width = change.dimensions.width;
|
||||||
element.computed.height = change.dimensions.height;
|
element.computed.height = change.dimensions.height;
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof change.updateStyle !== 'undefined') {
|
if (change.resizing) {
|
||||||
element.style = Object.assign({}, element.style, change.updateStyle);
|
element.width = change.dimensions.width;
|
||||||
|
element.height = change.dimensions.height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof change.resizing === 'boolean') {
|
if (typeof change.resizing === 'boolean') {
|
||||||
|
|||||||
Reference in New Issue
Block a user