Give a length with no share in it its own type again
`UiScalar` was `Len` without the `leftover` weight, which is the separation canonical `main` already had as `Len` beside `LayoutLen` and this branch collapsed. It is needed back for the queued clamp: a cap may not contain a share, because a cap has to read the report a rule otherwise makes moot, and a share puts the container's division into the same equation -- two self-consistent assignments, which is the multiple-fixed-point failure generated seed 13 punished for orthogonal sizing. `min(report, cap)` is not a `LayoutLen` either: it is a sum of parts, and the smaller of two of them is not one. So `UiScalar` is `Len`, what was `Len` is `LayoutLen`, and the two say in their docs which is which: a `Len` is pixels plus a fraction of a box -- a position being the length from the box's start, which is why a span is two of them -- and a `LayoutLen` is a `Len` plus a claim only a container dividing its room can answer. `From<Len> for LayoutLen` is the one-way step between them. Names only; the shader's `UiScalar` is renamed with them. Checked: fmt, clippy, 105 tests, and `tabs`, `minimal`, `view`, `text` and `random` byte-identical at 1920x1200. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4f5e27cba9
commit
a8898aaa54
27 files changed
+218
-202
No files matched your search
@@ -125,10 +125,7 @@ fn moving_an_ordinary_subtree_remaps_its_mask() {
|
||||
let active = &h.render.active[&masked.id()];
|
||||
assert_eq!(
|
||||
h.rsc.ui().masks[active.mask.idx()].region,
|
||||
UiRegion::new(
|
||||
UiSpan::new(UiScalar::px(150.0), UiScalar::rel_max()),
|
||||
UiSpan::FULL,
|
||||
)
|
||||
UiRegion::new(UiSpan::new(Len::px(150.0), Len::rel_max()), UiSpan::FULL,)
|
||||
);
|
||||
assert_corners!(h, inner, (150, 0), (400, 200));
|
||||
}
|
||||
@@ -312,7 +309,7 @@ fn a_span_ruled_across_itself_moves_its_child_without_redrawing_it() {
|
||||
|
||||
assert_eq!(draws.get(), settled);
|
||||
assert_corners!(h, leaf, (0, 0), (400, 100));
|
||||
assert_eq!(h.render.active[&span.id()].size.y, Len::rel(1.0));
|
||||
assert_eq!(h.render.active[&span.id()].size.y, LayoutLen::rel(1.0));
|
||||
}
|
||||
|
||||
/// The output is the root of the box chain, so a resize is a box that changed
|
||||
@@ -407,12 +404,12 @@ fn a_box_change_within_one_step_is_not_a_change() {
|
||||
|
||||
let step = Px::STEP.to_f32();
|
||||
for part in [0.1, 0.2, 0.3] {
|
||||
h.rsc[first].size.x = Len::px(100.0 + step * part);
|
||||
h.rsc[first].size.x = LayoutLen::px(100.0 + step * part);
|
||||
h.frame();
|
||||
assert_eq!(draws.get(), settled);
|
||||
}
|
||||
|
||||
h.rsc[first].size.x = Len::px(100.0 + step);
|
||||
h.rsc[first].size.x = LayoutLen::px(100.0 + step);
|
||||
h.frame();
|
||||
assert_eq!(draws.get(), settled + 1);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user