From 953685a88267894ea3fa40f2b99139c3c4e784d6 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Mon, 21 Oct 2024 17:37:11 -0400 Subject: [PATCH] fix(input): fallback on text layout for dnd --- src/widget/text_input/input.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/widget/text_input/input.rs b/src/widget/text_input/input.rs index 2b8f424c..bea23db8 100644 --- a/src/widget/text_input/input.rs +++ b/src/widget/text_input/input.rs @@ -844,7 +844,7 @@ where cursor_position: mouse::Cursor, viewport: &Rectangle, ) { - let text_layout = self.text_layout(layout.clone()); + let text_layout = self.text_layout(layout); draw( renderer, theme, @@ -2008,7 +2008,8 @@ pub fn draw<'a, Message>( let mut children_layout = layout.children(); let bounds = layout.bounds(); - let text_bounds = children_layout.next().unwrap().bounds(); + // XXX Dnd widget may not have a layout with children, so we just use the text_layout + let text_bounds = children_layout.next().unwrap_or(text_layout).bounds(); let is_mouse_over = cursor_position.is_over(bounds);