Merge pull request #4630 from xyflow/refactor/minimap-init

Refactor/minimap init
This commit is contained in:
Moritz Klack
2024-09-05 17:34:37 +02:00
committed by GitHub
2 changed files with 9 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@xyflow/react': patch
---
minimap: use latest node dimensions
@@ -79,14 +79,17 @@ function NodeComponentWrapperInner<NodeType extends Node>({
onClick: MiniMapNodesProps['onClick'];
shapeRendering: string;
}) {
const { node, x, y } = useStore((s) => {
const { node, x, y, width, height } = useStore((s) => {
const node = s.nodeLookup.get(id) as InternalNode<NodeType>;
const { x, y } = node.internals.positionAbsolute;
const { width, height } = getNodeDimensions(node);
return {
node,
x,
y,
width,
height,
};
}, shallow);
@@ -94,8 +97,6 @@ function NodeComponentWrapperInner<NodeType extends Node>({
return null;
}
const { width, height } = getNodeDimensions(node);
return (
<NodeComponent
x={x}