fix(getNodesBounds): use absolute position by default, add options param

This commit is contained in:
moklick
2024-01-25 17:46:46 +01:00
parent e352f3cdc4
commit 19bcfe28a2
11 changed files with 33 additions and 18 deletions
@@ -25,7 +25,8 @@ const selector = (s: ReactFlowState) => {
return {
viewBB,
boundingRect: s.nodes.length > 0 ? getBoundsOfRects(getNodesBounds(s.nodes, s.nodeOrigin), viewBB) : viewBB,
boundingRect:
s.nodes.length > 0 ? getBoundsOfRects(getNodesBounds(s.nodes, { nodeOrigin: s.nodeOrigin }), viewBB) : viewBB,
rfId: s.rfId,
nodeOrigin: s.nodeOrigin,
panZoom: s.panZoom,
@@ -73,7 +73,7 @@ export function NodeToolbar({
return null;
}
const nodeRect: Rect = getNodesBounds(nodes, nodeOrigin);
const nodeRect: Rect = getNodesBounds(nodes, { nodeOrigin });
const zIndex: number = Math.max(...nodes.map((node) => (node[internalsSymbol]?.z || 1) + 1));
const wrapperStyle: CSSProperties = {