Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

Conversation

@alikhani-dev
Copy link

Summary

Adds comprehensive selection method tracking to enable developers to understand how selections occurred and implement different behaviors based on selection method.

Changes Made

  • Add selectionMethod field to NodeSelectionChange and EdgeSelectionChange types
  • Track 6 different selection methods: click, drag, rectangle, keyboard, multi-select, programmatic
  • Update selection logic across all interaction points (click, drag, rectangle selection, keyboard, etc.)
  • Add selectionMethod parameter to addSelectedNodes and addSelectedEdges actions
  • Create comprehensive SelectionMethod example with real-time tracking and visual indicators
  • Maintain backward compatibility - selectionMethod field is optional

Benefits

  • Enhanced UX: Different UI feedback based on selection method
  • Better Analytics: Track user interaction patterns
  • Developer Experience: More control over selection behavior
  • Backward Compatible: Existing code continues to work unchanged

Testing

  • ✅ All existing tests pass
  • ✅ New SelectionMethod example demonstrates all selection methods
  • ✅ Backward compatibility verified

Example Usage

onSelectionChange={(event) => {
  event.nodes.forEach(node => {
    if (node.selectionMethod === 'click') {
      // Show immediate feedback for click selection
    } else if (node.selectionMethod === 'drag') {
      // Show different feedback for drag selection
    }
  });
}}

- Add \selectionMethod\ field to \NodeSelectionChange\ and \EdgeSelectionChange\ types
- Track 6 different selection methods: click, drag, rectangle, keyboard, multi-select, programmatic
- Update selection logic across all interaction points (click, drag, rectangle selection, keyboard, etc.)
- Add \selectionMethod\ parameter to \�ddSelectedNodes\ and \�ddSelectedEdges\ actions
- Create comprehensive SelectionMethod example with real-time tracking and visual indicators
- Maintain backward compatibility - \selectionMethod\ field is optional

This enables developers to understand how selections occurred and implement
different behaviors based on selection method (e.g., different UI feedback
for click vs drag selection).
@changeset-bot
Copy link

changeset-bot bot commented Sep 18, 2025

🦋 Changeset detected

Latest commit: 858296b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@xyflow/react Minor
@xyflow/system Minor
@xyflow/svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@moklick
Copy link
Member

moklick commented Oct 1, 2025

Thanks for your PR! We will have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants