Skip to content

Add PointerCaptureMap#24396

Open
joaoconceicao12 wants to merge 1 commit into
bevyengine:mainfrom
joaoconceicao12:feature-21754
Open

Add PointerCaptureMap#24396
joaoconceicao12 wants to merge 1 commit into
bevyengine:mainfrom
joaoconceicao12:feature-21754

Conversation

@joaoconceicao12
Copy link
Copy Markdown

Objective

Fixes #21754

When dragging widgets like sliders, the pointer often moves faster than the widget can follow. It drifts outside the bounding box while the button is held, breaking the interaction.

Solution

Added PointerCaptureMap resource to lock a pointer's hover state to an entity. The generate_hovermap system now applies captures after computing the normal hover map, so captured pointers only report the capturing entity.

Public API:

  • capture(pointer, entity, hit) — lock pointer
  • release(pointer) — unlock
  • get(pointer) — query capture
  • is_captured(pointer) — check status

Includes unit tests and a draggable_slider example demonstrating the feature.

@laundmo laundmo added A-Picking Pointing at and selecting objects of all sorts C-Feature A new feature, making something new possible A-Pointers Relating to Bevy pointer abstractions D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels May 23, 2026
@kfc35 kfc35 added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label May 24, 2026
Allows entities to lock a pointer's hover state. While captured,
generate_hovermap reports only the capturing entity as hovered,
even if the pointer drifts outside its bounding box.

Useful for drag interactions like sliders where the pointer can
move faster than the widget.

Includes unit tests and draggable_slider example.

Closes bevyengine#21754

Co-authored-by: Rodrigo Gomes <rodrigo.c.gomes@tecnico.ulisboa.pt>
Signed-off-by: João Conceição <joao.conceicao@tecnico.ulisboa.pt>
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-Pointers Relating to Bevy pointer abstractions C-Feature A new feature, making something new possible 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support pointer capture

3 participants