Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix selection change callback not called on first pointer move #1339

Merged
merged 1 commit into from
Jan 6, 2023

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Jan 5, 2023

Very minor, subtle bug: consumers of SelectionTool registering an onSelectionChange callback were not being notified of the first pointer move event. SelectionTool was calling onSelectionStart but not onSelectionChange after the first pointer move event. This is now corrected.

if (selection) {
// Previous selection was undefined and current selection is now defined => selection has started
if (!prevSelectionState?.selection) {
onSelectionStartRef.current?.(selection);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No return here, so onSelectionChange gets called.

@axelboc axelboc requested a review from loichuder January 5, 2023 10:41
Base automatically changed from selection-state to main January 5, 2023 12:54
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