fix(react): dont allow invalid selection rect
This commit is contained in:
@@ -54,26 +54,24 @@ const DefaultNodes = () => {
|
||||
|
||||
const updateNodePositions = () => {
|
||||
instance.setNodes((nodes) =>
|
||||
nodes.map((node) => {
|
||||
node.position = {
|
||||
nodes.map((node) => ({
|
||||
...node,
|
||||
position: {
|
||||
x: Math.random() * 400,
|
||||
y: Math.random() * 400,
|
||||
};
|
||||
|
||||
return node;
|
||||
})
|
||||
},
|
||||
}))
|
||||
);
|
||||
};
|
||||
|
||||
const updateEdgeColors = () => {
|
||||
instance.setEdges((edges) =>
|
||||
edges.map((edge) => {
|
||||
edge.style = {
|
||||
edges.map((edge) => ({
|
||||
...edge,
|
||||
style: {
|
||||
stroke: '#ff5050',
|
||||
};
|
||||
|
||||
return edge;
|
||||
})
|
||||
},
|
||||
}))
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@ export default function NodeInspector() {
|
||||
<ViewportPortal>
|
||||
<div className="react-flow__devtools-nodeinspector">
|
||||
{nodes.map((node) => {
|
||||
const x = node.computed?.positionAbsolute?.x || 0;
|
||||
const y = node.computed?.positionAbsolute?.y || 0;
|
||||
const width = node.computed?.width || 0;
|
||||
const height = node.computed?.height || 0;
|
||||
const x = node?.position?.x || 0;
|
||||
const y = node?.position?.y || 0;
|
||||
const width = node.measured?.width || 0;
|
||||
const height = node.measured?.height || 0;
|
||||
|
||||
return (
|
||||
<NodeInfo
|
||||
|
||||
Reference in New Issue
Block a user