Add PointerCaptureMap#24396
Open
joaoconceicao12 wants to merge 1 commit into
Open
Conversation
648a4d0 to
1c34001
Compare
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>
1c34001 to
dbc715e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
PointerCaptureMapresource to lock a pointer's hover state to an entity. Thegenerate_hovermapsystem now applies captures after computing the normal hover map, so captured pointers only report the capturing entity.Public API:
capture(pointer, entity, hit)— lock pointerrelease(pointer)— unlockget(pointer)— query captureis_captured(pointer)— check statusIncludes unit tests and a
draggable_sliderexample demonstrating the feature.