Block hovering behind overlays
This commit is contained in:
@@ -131,8 +131,7 @@ impl Element for MouseEventHandler {
|
||||
|
||||
cx.scene.push_mouse_region(MouseRegion {
|
||||
view_id: cx.current_view_id(),
|
||||
tag: self.tag,
|
||||
region_id: self.id,
|
||||
discriminant: Some((self.tag, self.id)),
|
||||
bounds: self.hit_bounds(bounds),
|
||||
hover: None,
|
||||
click: self.click_handler.clone(),
|
||||
|
||||
@@ -3,8 +3,8 @@ use serde_json::json;
|
||||
use crate::{
|
||||
geometry::{rect::RectF, vector::Vector2F},
|
||||
json::ToJson,
|
||||
DebugContext, Element, ElementBox, Event, EventContext, LayoutContext, PaintContext,
|
||||
SizeConstraint,
|
||||
DebugContext, Element, ElementBox, Event, EventContext, LayoutContext, MouseRegion,
|
||||
PaintContext, SizeConstraint,
|
||||
};
|
||||
|
||||
pub struct Overlay {
|
||||
@@ -54,6 +54,11 @@ impl Element for Overlay {
|
||||
let origin = self.abs_position.unwrap_or(bounds.origin());
|
||||
let visible_bounds = RectF::new(origin, *size);
|
||||
cx.scene.push_stacking_context(None);
|
||||
cx.scene.push_mouse_region(MouseRegion {
|
||||
view_id: cx.current_view_id(),
|
||||
bounds: visible_bounds,
|
||||
..Default::default()
|
||||
});
|
||||
self.child.paint(origin, visible_bounds, cx);
|
||||
cx.scene.pop_stacking_context();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user