Say region and placement, not extent

The split box was named `region` and `placement` on 2026-09-17; `frame`
came back as a length and survived, `extent` did not. It stayed as the
name for both halves, distinguished only by prose: `draw_at` bound the
caller's `part` to a parameter called `extent`, and `ActiveData` held two
`UiRegion`s that `draw_at` wrote `part: extent` from.

The box a parent asks a widget in is now the region, and where its
drawing ends up is its placement. `Painter`'s four holds accumulators
become the one `LayoutHolds` they were assembled into, which also drops
the name mapping between them.

The cold dump of 400 depth-5 trees is byte-identical across the change.
This commit is contained in:
iris-ai committed 2026-09-19 14:49:56 -04:00
1 parent 84dad211f5
commit 5642f2010a
13 files changed
+212 -227

No files matched your search

+16 -16
View File
@@ -22,34 +22,34 @@ const AXES: [Axis; 2] = [Axis::X, Axis::Y];
pub struct LayoutHolds {
pub window: [Holds; 2],
pub frame_len: [Option<Len>; 2],
pub extent: [Holds; 2],
pub extent_len: [Option<Len>; 2],
pub region: [Holds; 2],
pub region_len: [Option<Len>; 2],
}
impl LayoutHolds {
pub const ANY: Self = Self {
window: [Holds::ANY; 2],
frame_len: [None; 2],
extent: [Holds::ANY; 2],
extent_len: [None; 2],
region: [Holds::ANY; 2],
region_len: [None; 2],
};
pub fn and(self, other: Self) -> Self {
let mut result = Self::ANY;
for n in 0..2 {
result.window[n] = self.window[n].and(other.window[n]);
result.extent[n] = self.extent[n].and(other.extent[n]);
result.region[n] = self.region[n].and(other.region[n]);
debug_assert!(
self.extent_len[n].is_none()
|| other.extent_len[n].is_none()
|| self.extent_len[n] == other.extent_len[n]
self.region_len[n].is_none()
|| other.region_len[n].is_none()
|| self.region_len[n] == other.region_len[n]
);
debug_assert!(
self.frame_len[n].is_none()
|| other.frame_len[n].is_none()
|| self.frame_len[n] == other.frame_len[n]
);
result.extent_len[n] = self.extent_len[n].or(other.extent_len[n]);
result.region_len[n] = self.region_len[n].or(other.region_len[n]);
result.frame_len[n] = self.frame_len[n].or(other.frame_len[n]);
}
result
@@ -59,21 +59,21 @@ impl LayoutHolds {
(0..2).all(|n| {
self.window[n].lo <= other.window[n].lo
&& self.window[n].hi >= other.window[n].hi
&& self.extent[n].lo <= other.extent[n].lo
&& self.extent[n].hi >= other.extent[n].hi
&& self.extent_len[n].is_none_or(|len| other.extent_len[n] == Some(len))
&& self.region[n].lo <= other.region[n].lo
&& self.region[n].hi >= other.region[n].hi
&& self.region_len[n].is_none_or(|len| other.region_len[n] == Some(len))
&& self.frame_len[n].is_none_or(|len| other.frame_len[n] == Some(len))
})
}
pub fn contains(self, window: PxVec2, frame: UiVec2, extent: UiRegion) -> bool {
pub fn contains(self, window: PxVec2, frame: UiVec2, region: UiRegion) -> bool {
AXES.into_iter().all(|axis| {
let n = axis as usize;
let len = extent.axis(axis).len();
let len = region.axis(axis).len();
self.window[n].contains(window.axis(axis))
&& self.frame_len[n].is_none_or(|pinned| pinned == frame.axis(axis))
&& self.extent[n].contains(len.to_px(window.axis(axis)))
&& self.extent_len[n].is_none_or(|pinned| pinned == len)
&& self.region[n].contains(len.to_px(window.axis(axis)))
&& self.region_len[n].is_none_or(|pinned| pinned == len)
})
}
}