Allow specifying a custom height for stacking contexts

This commit is contained in:
Antonio Scandurra 2022-10-25 13:41:47 +02:00
parent 2055f05b09
commit dfe2fd0386
6 changed files with 21 additions and 10 deletions

View file

@ -16,6 +16,7 @@ pub struct Overlay {
fit_mode: OverlayFitMode,
position_mode: OverlayPositionMode,
hoverable: bool,
height: Option<usize>,
}
#[derive(Copy, Clone)]
@ -82,6 +83,7 @@ impl Overlay {
fit_mode: OverlayFitMode::None,
position_mode: OverlayPositionMode::Window,
hoverable: false,
height: None,
}
}
@ -109,6 +111,11 @@ impl Overlay {
self.hoverable = hoverable;
self
}
pub fn with_height(mut self, height: usize) -> Self {
self.height = Some(height);
self
}
}
impl Element for Overlay {
@ -204,7 +211,7 @@ impl Element for Overlay {
OverlayFitMode::None => {}
}
cx.paint_stacking_context(None, |cx| {
cx.paint_stacking_context(None, self.height, |cx| {
if self.hoverable {
enum OverlayHoverCapture {}
// Block hovers in lower stacking contexts