dnd_source: Add suppport for surface offset

The `drag_icon` callback is passed the offset of the cursor within the
widget at the start of the drag, and can return an offset the drag
surface should be placed relative to the cursor.
This commit is contained in:
Ian Douglas Scott 2025-01-07 13:56:58 -08:00 committed by Jeremy Soller
parent aaa2ba3ad4
commit af9e353f50
3 changed files with 14 additions and 8 deletions

View file

@ -1350,12 +1350,13 @@ where
clipboard,
false,
id.map(|id| iced_core::clipboard::DndSource::Widget(id)),
Some((
Some(iced_core::clipboard::IconSurface::new(
Element::from(
TextInput::<'static, ()>::new("", input_text.clone())
.dnd_icon(true),
),
iced_core::widget::tree::State::new(state_clone),
Vector::ZERO,
)),
Box::new(TextInputString(input_text)),
DndAction::Move,