refactor(react): use latest node dimensions
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user