refactor(react): use latest node dimensions

This commit is contained in:
moklick
2024-09-05 17:33:02 +02:00
parent cd0f1b58c3
commit 4a5d522604

View File

@@ -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}