Rename a length's abs component to px
`dp` is coming, and then `abs` says which of the two it is not. The component has always been a pixel count, so the name that admits it is the one that leaves room for a second unit beside it. Mechanical: the field on `Len` and `UiScalar`, their constructors, `to_abs`/`get_abs`, the matching WGSL struct member and the locals composing it. Field order and types are unchanged, so the `Pod` layout the shader reads is the same bytes. `f32::abs` is untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f7cd8251b
commit
7c50a3e51b
22 files changed
+120
-124
No files matched your search
+5
-5
@@ -54,7 +54,7 @@ fn a_child_drawn_twice_moves_once() {
|
||||
h.set_root((left, centered).span(Dir::RIGHT));
|
||||
assert_corners!(h, inner, (100, 0), (300, 200));
|
||||
|
||||
h.rsc[left].x = Some(Len::abs(150));
|
||||
h.rsc[left].x = Some(Len::px(150));
|
||||
h.frame();
|
||||
|
||||
assert_corners!(h, inner, (150, 0), (350, 200));
|
||||
@@ -104,7 +104,7 @@ fn a_fixed_box_is_drawn_again_rather_than_stretched() {
|
||||
h.set_root(stack.align(Align::TOP));
|
||||
assert_corners!(h, panel, (0, 0), (400, 100));
|
||||
|
||||
h.rsc[leaf].y = Some(Len::abs(250));
|
||||
h.rsc[leaf].y = Some(Len::px(250));
|
||||
h.frame();
|
||||
|
||||
assert_corners!(h, panel, (0, 0), (400, 250));
|
||||
@@ -119,7 +119,7 @@ fn a_moved_subtree_takes_its_children_with_it() {
|
||||
h.set_root((first, row).span(Dir::DOWN));
|
||||
assert_corners!(h, inner, (10, 50), (390, 70));
|
||||
|
||||
h.rsc[first].y = Some(Len::abs(80));
|
||||
h.rsc[first].y = Some(Len::px(80));
|
||||
h.frame();
|
||||
|
||||
// The row is the same shape somewhere else, so one slot moved it and
|
||||
@@ -140,7 +140,7 @@ fn a_fixed_length_child_keeps_it_when_the_box_around_it_grows() {
|
||||
assert_corners!(h, fixed, (100, 0), (150, 200));
|
||||
assert_corners!(h, rest, (150, 0), (400, 200));
|
||||
|
||||
h.rsc[bar].x = Some(Len::abs(200));
|
||||
h.rsc[bar].x = Some(Len::px(200));
|
||||
h.frame();
|
||||
|
||||
// The panel's box is 100 shorter, so the fixed child is the same 50 wide
|
||||
@@ -163,7 +163,7 @@ fn a_box_with_a_fixed_length_can_be_stretched_on_its_other_axis() {
|
||||
h.set_root((bar, column).span(Dir::RIGHT));
|
||||
assert_corners!(h, inner, (110, 10), (390, 30));
|
||||
|
||||
h.rsc[bar].x = Some(Len::abs(200));
|
||||
h.rsc[bar].x = Some(Len::px(200));
|
||||
h.frame();
|
||||
|
||||
assert_corners!(h, inner, (210, 10), (390, 30));
|
||||
|
||||
Reference in new issue
Block a user