summaryrefslogtreecommitdiffstats
path: root/widget/src/tooltip.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-11-21 18:11:31 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-11-21 18:58:54 +0100
commitf67387f2d80e744618a5f4f107509ba24802146c (patch)
tree959e84e0dbfa83b36bf08680b511d194b37509a2 /widget/src/tooltip.rs
parent7dd32f3be43c72e11dac5e07918e9ad6d36b6555 (diff)
downloadiced-f67387f2d80e744618a5f4f107509ba24802146c.tar.gz
iced-f67387f2d80e744618a5f4f107509ba24802146c.tar.bz2
iced-f67387f2d80e744618a5f4f107509ba24802146c.zip
Invalidate layout when `Tooltip` changes `overlay`
Diffstat (limited to '')
-rw-r--r--widget/src/tooltip.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/widget/src/tooltip.rs b/widget/src/tooltip.rs
index b041d2e9..9745bc1c 100644
--- a/widget/src/tooltip.rs
+++ b/widget/src/tooltip.rs
@@ -157,11 +157,19 @@ where
) -> event::Status {
let state = tree.state.downcast_mut::<State>();
+ let was_idle = *state == State::Idle;
+
*state = cursor
.position_over(layout.bounds())
.map(|cursor_position| State::Hovered { cursor_position })
.unwrap_or_default();
+ let is_idle = *state == State::Idle;
+
+ if was_idle != is_idle {
+ shell.invalidate_layout();
+ }
+
self.content.as_widget_mut().on_event(
&mut tree.children[0],
event,
@@ -289,7 +297,7 @@ pub enum Position {
Right,
}
-#[derive(Debug, Clone, Copy, Default)]
+#[derive(Debug, Clone, Copy, PartialEq, Default)]
enum State {
#[default]
Idle,