From 87afd5b79d5de24259e1c81204d7302bf1fc8844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 2 May 2025 22:41:22 +0200 Subject: [PATCH] Fix `mouse_interaction` implementation for `float` --- widget/src/float.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/widget/src/float.rs b/widget/src/float.rs index aa0121a8..f58e4f25 100644 --- a/widget/src/float.rs +++ b/widget/src/float.rs @@ -365,17 +365,27 @@ where fn mouse_interaction( &self, - _layout: Layout<'_>, + layout: Layout<'_>, cursor: mouse::Cursor, renderer: &Renderer, ) -> mouse::Interaction { - self.float.content.as_widget().mouse_interaction( + if !cursor.is_over(layout.bounds()) { + return mouse::Interaction::None; + } + + let interaction = self.float.content.as_widget().mouse_interaction( self.state, self.layout, cursor * self.transformation.inverse(), &self.viewport, renderer, - ) + ); + + if self.float.opaque && interaction == mouse::Interaction::None { + return mouse::Interaction::Idle; + } + + interaction } fn index(&self) -> f32 {