From 8ecd857e27cf97167692d44309100fcc97acfd62 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Tue, 5 Nov 2024 17:27:13 -0500 Subject: [PATCH] fix: offset DnD events in scrollable --- widget/src/scrollable.rs | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index fcf6f2421d..87bcf9319c 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -763,10 +763,40 @@ where let translation = state.translation(self.direction, bounds, content_bounds); + let mut c_event = match event.clone() { + Event::Dnd(dnd::DndEvent::Offer( + id, + dnd::OfferEvent::Enter { + x, + y, + mime_types, + surface, + }, + )) => Event::Dnd(dnd::DndEvent::Offer( + id.clone(), + dnd::OfferEvent::Enter { + x: x + translation.x as f64, + y: y + translation.y as f64, + mime_types: mime_types.clone(), + surface: surface.clone(), + }, + )), + Event::Dnd(dnd::DndEvent::Offer( + id, + dnd::OfferEvent::Motion { x, y }, + )) => Event::Dnd(dnd::DndEvent::Offer( + id.clone(), + dnd::OfferEvent::Motion { + x: x + translation.x as f64, + y: y + translation.y as f64, + }, + )), + e => e, + }; self.content.as_widget_mut().on_event( &mut tree.children[0], - event.clone(), + c_event, content, cursor, renderer,