From e9093870111cb3a8ca909c05a94a1d4d4bf7fbf5 Mon Sep 17 00:00:00 2001 From: Miles Silberling-Cook Date: Thu, 19 Sep 2024 17:01:38 -0400 Subject: [PATCH] Add back missing DragOver event dispatcher --- crates/bevy_picking/src/events.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/crates/bevy_picking/src/events.rs b/crates/bevy_picking/src/events.rs index 3a07e4f7e2..8e868060f2 100644 --- a/crates/bevy_picking/src/events.rs +++ b/crates/bevy_picking/src/events.rs @@ -525,10 +525,30 @@ pub fn pointer_events( drag.latest_pos = location.position; let event = Pointer::new(pointer_id, location.clone(), drag_event); commands.trigger_targets(event, *drag_target); + + // Emit corresponding DragOver to the hovered entities + for (hovered_entity, hit) in hover_map + .get(&pointer_id) + .iter() + .flat_map(|h| h.iter().map(|(entity, data)| (*entity, data.to_owned()))) + .filter(|(hovered_entity, _)| *hovered_entity != *drag_target) + { + commands.trigger_targets( + Pointer::new( + pointer_id, + location.clone(), + DragOver { + button, + dragged: *drag_target, + hit: hit.clone(), + }, + ), + hovered_entity, + ); + } } } - // Triggers during movement over specific entities for (hovered_entity, hit) in hover_map .get(&pointer_id) .iter()