Restrict multiple hovered regions to a single stacking context

We won't hover regions from stacking contexts that are below the one being hovered.
This commit is contained in:
Nathan Sobo 2022-05-27 11:09:07 -06:00
parent 9099c40364
commit 5413a97c7e
3 changed files with 20 additions and 13 deletions

View file

@ -210,11 +210,16 @@ impl Scene {
.collect()
}
pub fn mouse_regions(&self) -> Vec<MouseRegion> {
self.layers()
.flat_map(|layer| &layer.mouse_regions)
.cloned()
.collect()
pub fn mouse_regions(&self) -> Vec<(MouseRegion, usize)> {
let mut regions = Vec::new();
for (stacking_depth, stacking_context) in self.stacking_contexts.iter().enumerate() {
for layer in &stacking_context.layers {
for mouse_region in &layer.mouse_regions {
regions.push((mouse_region.clone(), stacking_depth));
}
}
}
regions
}
pub fn push_stacking_context(&mut self, clip_bounds: Option<RectF>) {