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

Only single Pointer<Click> when multiple hits against Pickable::should_block_lower:false #15290

Closed
brandon-reinhart opened this issue Sep 18, 2024 · 0 comments · Fixed by #15293
Labels
A-Picking Pointing at and selecting objects of all sorts C-Bug An unexpected or incorrect behavior
Milestone

Comments

@brandon-reinhart
Copy link
Contributor

brandon-reinhart commented Sep 18, 2024

Bevy version

bevy-0.15-dev as of around 9/18/24

What you did

What went wrong

If you have multiple sprites overlapping at different z in 2d ortho and they are Pickable with should_block_lower set to false, I used to get multiple Pointer Click for each one. With the recent change to hit ordering (#14862), I now only get the top-most Pointer Click. It seems like should_block_lower is not being respected.

@brandon-reinhart brandon-reinhart added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Sep 18, 2024
@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Sep 18, 2024
@alice-i-cecile alice-i-cecile added A-Picking Pointing at and selecting objects of all sorts and removed S-Needs-Triage This issue needs to be labelled labels Sep 18, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 20, 2024
# Objective

- Intended to resolve #15290.
- Fix four duplicate `DragEnd` firing when drag finished.
- Fix redundant `DragStart` firing when dragging across pick-able
entities.
- Fix `Click` coming after `Drop` and obliterating finished drag
interactions.

Big thanks to B. Reinhart for testing picking in their codebase and
identifying these issues early.

## Solution

- Fix press & drag state being cleared after the first entity is read
from the hover map on pointer release, rather than after all entities
are read. This caused only the first hovered entity to receive `Up` and
`Click` events.
- Fixes `Down` being determined using the `previous_hover_map` rather
than `hover_map`, a regression compared to `bevy_mod_picking`. I think
this is what was messing up drag events.
- Fixes and issue where `PointerEnd` would fire multiple times and
`PointerStart` would fire when dragging onto a new entity.
- Re-orders events to make them easier to handle. `Out` now fired before
`DragLeave` and `Click/Up` now fire before `DragDrop`.
- Generally refactors the picking event code to be more clean and sane. 

## Testing

These changes are currently sporadically tested.
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 C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants