refactor(react): use latest node dimensions
This commit is contained in:
@@ -79,14 +79,17 @@ function NodeComponentWrapperInner<NodeType extends Node>({
|
|||||||
onClick: MiniMapNodesProps['onClick'];
|
onClick: MiniMapNodesProps['onClick'];
|
||||||
shapeRendering: string;
|
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 node = s.nodeLookup.get(id) as InternalNode<NodeType>;
|
||||||
const { x, y } = node.internals.positionAbsolute;
|
const { x, y } = node.internals.positionAbsolute;
|
||||||
|
const { width, height } = getNodeDimensions(node);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
node,
|
node,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
};
|
};
|
||||||
}, shallow);
|
}, shallow);
|
||||||
|
|
||||||
@@ -94,8 +97,6 @@ function NodeComponentWrapperInner<NodeType extends Node>({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { width, height } = getNodeDimensions(node);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeComponent
|
<NodeComponent
|
||||||
x={x}
|
x={x}
|
||||||
|
|||||||
Reference in New Issue
Block a user