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

+14 -15
View File
@@ -300,7 +300,7 @@ impl UiRenderState {
&& let Some(old_parent) = self.active.get_mut(&old_parent)
{
old_parent.children.retain(|child| *child != id);
old_parent.inherited_children.retain(|child| *child != id);
old_parent.extent_children.retain(|(child, _)| *child != id);
}
settled
}
@@ -373,7 +373,7 @@ impl UiRenderState {
textures: Vec::new(),
primitives: Vec::new(),
mask_region: None,
inherited_children: Vec::new(),
extent_children: Vec::new(),
children: Vec::new(),
offered: Vec::new(),
offered_px: info.offered_px,
@@ -410,7 +410,7 @@ impl UiRenderState {
textures,
primitives,
mask_region,
inherited_children,
extent_children,
extent_own,
extent_under,
children,
@@ -516,7 +516,7 @@ impl UiRenderState {
textures,
primitives,
mask_region,
inherited_children,
extent_children,
children,
size_deps,
declared: declared_lens(rsc.widgets(), id),
@@ -765,19 +765,18 @@ impl UiRenderState {
}
let parent_move = active.move_idx;
let mask = active.mask;
let children = active.inherited_children.len();
let children = active.extent_children.len();
for index in 0..children {
let child = self.active[&id].inherited_children[index];
let (child, extent) = self.active[&id].extent_children[index];
let (child_region, chosen) = extent.resolve(placement);
let active = &self.active[&child];
let (child_local, chosen) = ask_box(
UiRegion::FULL,
active.declared,
active.own_align,
[Some(placement.x), Some(placement.y)],
);
let (child_local, chosen) =
ask_box(child_region, active.declared, active.own_align, chosen);
// Keep the slot chosen from measurement: the final draw can
// report a different size, for example after text reflows.
let child_placement = UiRegion {
x: chosen[0].unwrap_or(UiSpan::FULL),
y: chosen[1].unwrap_or(UiSpan::FULL),
x: chosen[0].unwrap_or(active.placement.x),
y: chosen[1].unwrap_or(active.placement.y),
};
let child_info = DrawInfo {
layer: active.layer,
@@ -937,7 +936,7 @@ impl UiRenderState {
textures: Vec::new(),
primitives: Vec::new(),
mask_region: None,
inherited_children: Vec::new(),
extent_children: Vec::new(),
children: Vec::new(),
size_deps: Vec::new(),
move_idx: info.parent_move,