child nodes get repositioned correctly when resizing top or left
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
ResizeControlVariant,
|
||||
type ControlPosition,
|
||||
type XYResizerInstance,
|
||||
type XYResizerChange
|
||||
type XYResizerChange,
|
||||
type XYResizerChildChange
|
||||
} from '@xyflow/system';
|
||||
import type { ResizeControlProps } from './types';
|
||||
|
||||
@@ -66,7 +67,7 @@
|
||||
snapToGrid: !!$snapGrid
|
||||
};
|
||||
},
|
||||
onChange: (change: XYResizerChange) => {
|
||||
onChange: (change: XYResizerChange, childChanges: XYResizerChildChange[]) => {
|
||||
const node = $nodeLookup.get(id);
|
||||
if (node) {
|
||||
node.height = change.isHeightChange ? change.height : node.height;
|
||||
@@ -76,6 +77,13 @@
|
||||
? { x: change.x, y: change.y }
|
||||
: node.position;
|
||||
|
||||
childChanges.forEach((childChange) => {
|
||||
const childNode = $nodeLookup.get(childChange.id);
|
||||
if (childNode) {
|
||||
childNode.position = childChange.position;
|
||||
}
|
||||
});
|
||||
|
||||
$nodes = $nodes;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user