Put place before the rel base, and say what a Place decides

An argument that is usually `None` goes last. So `widget_at` and `place_at`
take the place first, and `narrow_rel_base` after it.

`Place` and `Part` also now say which of the two boxes they decide, since
that is the question a caller has to answer to pick between them: `Part` is
the child's region, said as a part of the caller's own, and `Within`/`Fill`
is what becomes of the placement in it.
This commit is contained in:
iris-ai committed 2026-09-19 17:16:41 -04:00
1 parent beb138632a
commit c55be21761
8 files changed
+41 -38

No files matched your search

+10 -7
View File
@@ -1,6 +1,7 @@
use crate::{AxisAlign, Len, PrimitiveHandle, UiRegion, UiSpan};
/// What of a widget's own box a child is given, along one axis.
/// A child's region along one axis, said as a part of the region the widget
/// saying it was given.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Part {
/// Window lengths from where the box starts, which is what a container
@@ -8,7 +9,7 @@ pub enum Part {
/// length, so the cursor that sums those reports is one too. A moved box
/// re-places every child by re-adding its start, exactly. A fraction
/// here is a fraction of the window and not of the box -- the whole of a
/// box is `Of(UiSpan::FULL)`, not a `rel(1.0)` span.
/// box is [`Self::WHOLE`], not a `rel(1.0)` span.
From(UiSpan),
/// A part of the box in its own coordinates, which is what a container
/// that insets one speaks: taking eleven pixels off the end needs no
@@ -42,12 +43,14 @@ impl Part {
}
}
/// Where a child goes along one axis, as a part of this widget's box.
/// A child's region along one axis, and what becomes of its placement in
/// that region once it has answered.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Place {
/// The child's answer, aligned inside the part by the child's alignment.
/// The placement is the child's answer, aligned inside the region by the
/// child's alignment.
Within(Part),
/// Exactly the part; the answer is not placed inside it again.
/// The region is the placement; the answer is not placed inside it again.
Fill(Part),
}
@@ -58,8 +61,8 @@ impl Place {
}
}
/// Whether the part is the drawing's box outright, rather than the box
/// the answer is placed inside.
/// Whether the region is the placement outright, rather than a box the
/// answer is placed inside.
pub(crate) fn fills(self) -> bool {
matches!(self, Self::Fill(_))
}