Only invalidate parent view on click/hover if we read that state when rendering
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
co-authored by
Max Brunsfeld
parent
934474f87e
commit
bc03592912
@@ -20,6 +20,8 @@ pub struct MouseRegion {
|
||||
pub bounds: RectF,
|
||||
pub handlers: HandlerSet,
|
||||
pub hoverable: bool,
|
||||
pub notify_on_hover: bool,
|
||||
pub notify_on_click: bool,
|
||||
}
|
||||
|
||||
impl MouseRegion {
|
||||
@@ -52,6 +54,8 @@ impl MouseRegion {
|
||||
bounds,
|
||||
handlers,
|
||||
hoverable: true,
|
||||
notify_on_hover: false,
|
||||
notify_on_click: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +141,16 @@ impl MouseRegion {
|
||||
self.hoverable = is_hoverable;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_notify_on_hover(mut self, notify: bool) -> Self {
|
||||
self.notify_on_hover = notify;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_notify_on_click(mut self, notify: bool) -> Self {
|
||||
self.notify_on_click = notify;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user