Merge pull request #5213 from xyflow/refactor/selection-events

Refactor/selection events
This commit is contained in:
Moritz Klack
2025-04-14 14:29:25 +02:00
committed by GitHub
2 changed files with 7 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
'@xyflow/react': patch
---
Do not trigger selection events if elementsSelectable=false

View File

@@ -19,13 +19,13 @@ const selector = (s: ReactFlowState) => {
const selectedEdges = [];
for (const [, node] of s.nodeLookup) {
if (node.selected) {
if (node.selected && (s.elementsSelectable || node.selectable)) {
selectedNodes.push(node.internals.userNode);
}
}
for (const [, edge] of s.edgeLookup) {
if (edge.selected) {
if (edge.selected && (s.elementsSelectable || edge.selectable)) {
selectedEdges.push(edge);
}
}