Merge branch 'next' into panecontextmenu-fix
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;
|
||||
|
||||
for (const childChange of childChanges) {
|
||||
const childNode = $nodeLookup.get(childChange.id);
|
||||
if (childNode) {
|
||||
childNode.position = childChange.position;
|
||||
}
|
||||
}
|
||||
|
||||
$nodes = $nodes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,28 +64,22 @@ export function createStore({
|
||||
}
|
||||
|
||||
const updateNodePositions: UpdateNodePositions = (nodeDragItems, dragging = false) => {
|
||||
store.nodes.update((nds) => {
|
||||
return nds.map((node) => {
|
||||
const nodeDragItem = (nodeDragItems as Array<Node | NodeDragItem>).find(
|
||||
(ndi) => ndi.id === node.id
|
||||
);
|
||||
const nodeLookup = get(store.nodeLookup);
|
||||
|
||||
if (nodeDragItem) {
|
||||
return {
|
||||
...node,
|
||||
dragging,
|
||||
position: nodeDragItem.position,
|
||||
computed: {
|
||||
...node.computed,
|
||||
positionAbsolute: nodeDragItem.computed?.positionAbsolute
|
||||
},
|
||||
[internalsSymbol]: node[internalsSymbol]
|
||||
};
|
||||
}
|
||||
nodeDragItems.forEach((nodeDragItem) => {
|
||||
const node = nodeLookup.get(nodeDragItem.id);
|
||||
|
||||
return node;
|
||||
});
|
||||
if (node) {
|
||||
node.position = nodeDragItem.position;
|
||||
node.dragging = dragging;
|
||||
node.computed = {
|
||||
...node.computed,
|
||||
positionAbsolute: nodeDragItem.computed?.positionAbsolute
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
store.nodes.set(get(store.nodes));
|
||||
};
|
||||
|
||||
function updateNodeDimensions(updates: Map<string, NodeDimensionUpdate>) {
|
||||
|
||||
Reference in New Issue
Block a user