fix(react): minimap nodes for subflows

This commit is contained in:
moklick
2024-01-03 13:22:15 +01:00
parent b3d2976682
commit 7649e70082
@@ -83,17 +83,24 @@ const NodeComponentWrapper = memo(function NodeComponentWrapper({
onClick: MiniMapNodesProps['onClick']; onClick: MiniMapNodesProps['onClick'];
shapeRendering: string; shapeRendering: string;
}) { }) {
const node = useStore((s) => s.nodeLookup.get(id)); const { node, x, y } = useStore((s) => {
const node = s.nodeLookup.get(id);
const { x, y } = getNodePositionWithOrigin(node, node?.origin || nodeOrigin).positionAbsolute;
return {
node,
x,
y,
};
}, shallow);
if (!node || node.hidden || !(node.computed?.width || node.width) || !(node.computed?.height || node.height)) { if (!node || node.hidden || !(node.computed?.width || node.width) || !(node.computed?.height || node.height)) {
return null; return null;
} }
const positionOrigin = getNodePositionWithOrigin(node, node.origin || nodeOrigin).positionAbsolute;
return ( return (
<NodeComponent <NodeComponent
x={positionOrigin.x} x={x}
y={positionOrigin.y} y={y}
width={node.computed?.width ?? node.width ?? 0} width={node.computed?.width ?? node.width ?? 0}
height={node.computed?.height ?? node.height ?? 0} height={node.computed?.height ?? node.height ?? 0}
style={node.style} style={node.style}