Skip to content

Fix Select tool gesture handling with touch shortcuts and clear stale selection previews - #1346

Merged
CodeDoctorDE merged 3 commits into
LinwoodDev:developfrom
decision-fatigue-is-real:bug/touch-select-race
Nov 5, 2026
Merged

CodeDoctorDE merged 3 commits into
LinwoodDev:developfrom
decision-fatigue-is-real:bug/touch-select-race

Conversation

@decision-fatigue-is-real

Copy link
Copy Markdown
Contributor

Description

Synchronises the selection handler with the pointer shortcut system, so that detecting events from the pointer shortcut system does not cancel the scale tool when in operation.

Problem

Previously, binding an action to double/triple tap for touches in the input menu in settings, while the touch shortcut was bound to a specific toolbar position corresponding to the Select tool, caused selections to not be processed in a majority of cases.

This was likely due to the Select tool's scale events being processed initially, then being overwritten by the pointer shortcut manager, which checks for multiple taps and cancels the Select tool's selection for Lasso and Rectangle modes.

Related Issue

Closes #1345

@CodeDoctorDE

Copy link
Copy Markdown
Member

I tested this with a left-button double-click shortcut and found two regressions:

  • Short rectangle drags are ignored even when the left mouse button is set to Active tool.
  • With Lasso active and the left mouse button mapped to Rectangle, a lasso outline can stay on the canvas after release.

I’d have the viewport cancel the pending click shortcut as soon as Flutter recognizes a drag, then replay the buffered pointer events before calling onScaleStart. That lets the mapped tool handle the whole gesture, including short drags below the shortcut manager’s movement threshold.

@decision-fatigue-is-real

Copy link
Copy Markdown
Contributor Author

Thank you for your reply. I've now implemented the suggestions, and now both of those regressions no longer occur.

if (bufferedEvents.isNotEmpty) {
await _replayPointerEvents(bufferedEvents, input);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i would save _inputGeneration before await and then test if _isCurrentInput. Otherwise i think the method would still run after the page is closed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for spotting this issue. I've now added in the _isCurrentInput check.

@CodeDoctorDE CodeDoctorDE left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now its look good!
Thanks for the multiple contributons

@github-project-automation github-project-automation Bot moved this to 🚧 In Progress in Butterfly Nov 5, 2026
@CodeDoctorDE
CodeDoctorDE merged commit 33af898 into LinwoodDev:develop Nov 5, 2026
18 checks passed
@github-project-automation github-project-automation Bot moved this from 🚧 In Progress to ✅ Done in Butterfly Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

[Bug]: Select tool behaves inconsistently when using touch shortcuts with double/triple-tap actions

2 participants