bevy/crates/bevy_picking/src
universe 5117e6fd49
don't filter dragged entity out of DragEnter events (#19179)
## produce a DragEnter event when reentering the dragged entity

when making a piano, i want dragging across the keys to trigger the
notes of each key, but currently if i drag out of a key, then back to
it, this will not work since the dragged entity gets filtered out

## Solution

- make DragEnter event work whenever there's an entry. if the user wants
to ignore the dragged entity they can compare `target` and `dragged`

## Testing

- tested this with a modified version of the 2d_shapes example. i added
an observer to the entities: (and added mesh picking plugin)
```rust
.observe(|t: Trigger<Pointer<DragEnter>>| {
    info!("entered {}, started from {}", t.target(), t.dragged);
}
```
- i'm not sure if other things need more testing, or if this is wrong
completely and breaks other things i don't know of!

---

## Showcase

before:


https://github.com/user-attachments/assets/48de606a-e44d-4ca1-ae16-d8dcef640d6e

after:


https://github.com/user-attachments/assets/b1be231f-c826-47bc-be43-c637f22e7846
2025-05-26 17:56:54 +00:00
..
mesh_picking Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
backend.rs Add boilerplate docs for PointerHits::new and HitData::new (#19259) 2025-05-19 19:22:07 +00:00
events.rs don't filter dragged entity out of DragEnter events (#19179) 2025-05-26 17:56:54 +00:00
hover.rs Rename bevy_platform_support to bevy_platform (#18813) 2025-04-11 23:13:28 +00:00
input.rs Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
lib.rs Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
pointer.rs fix(picking): Location is not a Component anymore. (#19306) 2025-05-22 01:33:01 +00:00
window.rs Renamed EventWriter::send methods to write. (#17977) 2025-02-23 21:18:52 +00:00