summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-03 04:34:13 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-03 04:34:13 +0100
commit3029481b72a2ca975a9bb915e23c0461334ba54f (patch)
tree30ce970fe6b9c81a0ab25836c50f16223dd716aa /widget
parent599d8b560bec8036c5ddda62a7bf0a540bdec396 (diff)
downloadiced-3029481b72a2ca975a9bb915e23c0461334ba54f.tar.gz
iced-3029481b72a2ca975a9bb915e23c0461334ba54f.tar.bz2
iced-3029481b72a2ca975a9bb915e23c0461334ba54f.zip
Ignore redraws of invisible content in `hover` widget
Diffstat (limited to 'widget')
-rw-r--r--widget/src/helpers.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs
index 17cf94cc..199b8fc0 100644
--- a/widget/src/helpers.rs
+++ b/widget/src/helpers.rs
@@ -871,16 +871,19 @@ where
shell.request_redraw();
}
+ let is_visible =
+ is_hovered || self.is_top_focused || self.is_top_overlay_active;
+
if matches!(
event,
Event::Mouse(
mouse::Event::CursorMoved { .. }
| mouse::Event::ButtonReleased(_)
)
- ) || is_hovered
- || self.is_top_focused
- || self.is_top_overlay_active
+ ) || is_visible
{
+ let redraw_request = shell.redraw_request();
+
self.top.as_widget_mut().update(
top_tree,
event.clone(),
@@ -891,6 +894,11 @@ where
shell,
viewport,
);
+
+ // Ignore redraw requests of invisible content
+ if !is_visible {
+ Shell::replace_redraw_request(shell, redraw_request);
+ }
};
if shell.is_event_captured() {