Retain child frames relative to the container extent

This commit is contained in:
iris-ai committed 2026-09-17 16:40:54 -04:00
1 parent a7307d95fd
commit c44bd198ee
6 files changed
+316 -62

No files matched your search

+16 -1
View File
@@ -41,7 +41,7 @@ pub struct ActiveData {
pub textures: Vec<TextureHandle>,
pub primitives: Vec<RetainedPrimitive>,
pub mask_region: Option<DrawRegion>,
pub inherited_children: Vec<WidgetId>,
pub(crate) extent_children: Vec<(WidgetId, ExtentPlacement)>,
pub children: Vec<WidgetId>,
/// The children whose size this widget read while drawing.
pub size_deps: Vec<WidgetId>,
@@ -87,3 +87,18 @@ impl ActiveData {
})
}
}
#[derive(Clone, Copy, Debug)]
pub(crate) enum ExtentPlacement {
Inherit,
Within(UiRegion),
}
impl ExtentPlacement {
pub fn resolve(self, extent: UiRegion) -> (UiRegion, [Option<crate::UiSpan>; 2]) {
match self {
Self::Inherit => (UiRegion::FULL, [Some(extent.x), Some(extent.y)]),
Self::Within(local) => (local.within(&extent), [None; 2]),
}
}
}