Skip to content

Multi-press support#24264

Open
ickshonpe wants to merge 11 commits into
bevyengine:mainfrom
ickshonpe:multi-press-support
Open

Multi-press support#24264
ickshonpe wants to merge 11 commits into
bevyengine:mainfrom
ickshonpe:multi-press-support

Conversation

@ickshonpe
Copy link
Copy Markdown
Contributor

@ickshonpe ickshonpe commented May 12, 2026

Objective

The text input widget selects the word under the pointer on a double click. This isn't correct, the select word edit should be queued on the press following a click. This allows for users to select a word with a double press and then hold the button and drag to extend the selection.

Solution

Track multi-presses as well as multi-clicks:

  • Add a count field to Press events.
  • Update the click count in PointerButtonState::clicking on consecutive presses within the multi-click duration, not on releases.
  • Filter the clicking map in both the Press and Click dispatchers.
  • Removed the MULTI_CLICK_DURATION const.
  • The multi-click duration can now be set using a new multi_click_duration field on the PickingSettings resource.

Testing

cargo run --example multiline_text_input

You should observe that dragging after selecting a word with a double press extends the selection.

ickshonpe added 3 commits May 12, 2026 14:44
This is to allow click then press and drag actions.

Text inputs no long observe `Click` events, instead they check `count` on press.
@ickshonpe ickshonpe added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets A-Text Rendering and layout for characters D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Picking Pointing at and selecting objects of all sorts labels May 12, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI May 12, 2026
@ickshonpe ickshonpe requested a review from jordanhalase May 13, 2026 09:04
@nicoburns
Copy link
Copy Markdown
Contributor

It's still not quite right as the selection is extended from the point in the word that was clicked, not the word itself. That's not something we can fix here (I think), it needs Parley to special case drag selects after word selection.

Pretty sure Parley's vello_editor example implements this, so it ought to be possible to do here.

@ickshonpe
Copy link
Copy Markdown
Contributor Author

ickshonpe commented May 13, 2026

Pretty sure Parley's vello_editor example implements this, so it ought to be possible to do here.

Yep you are right. It was the bug fixed by #24260 collapsing the selection before the drag with an extra move_to_point call. Merged with main, and it works correctly now.

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.

@jordanhalase
Copy link
Copy Markdown
Contributor

A great QoL improvement.

Something I've noticed when testing: Clicking on one word and then quickly clicking on a different word will select that whole word. Multi-press counter should be restarted when the cursor moves beyond a few pixels delta.

We could iterate though.

@ickshonpe
Copy link
Copy Markdown
Contributor Author

A great QoL improvement.

Something I've noticed when testing: Clicking on one word and then quickly clicking on a different word will select that whole word. Multi-press counter should be restarted when the cursor moves beyond a few pixels delta.

We could iterate though.

Yeah I deliberately ignored distance in the click PR and this one because I didn't want to bother with it because there might be some annoying scaling problems. I guess though maybe thinking about it now, we could just keep the timing in the picking module and then compare the distance in the widget logic. Then we could even have an explicit check that both presses are on the same word.

@ickshonpe ickshonpe added M-Release-Note Work that should be called out in the blog due to impact and removed M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels May 14, 2026
@ickshonpe ickshonpe added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label May 14, 2026
@ickshonpe
Copy link
Copy Markdown
Contributor Author

There's no need for a migration guide I think, there aren't any breaking changes.

ickshonpe added 3 commits May 15, 2026 10:02
… the MULTI_CLICK_DURATION const.

`pointer_events` now uses the duration from `PickingSettings` for multi-clicks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Picking Pointing at and selecting objects of all sorts A-Text Rendering and layout for characters A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes M-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

4 participants