Say on_axis for the lift, so it is not indexing's word
`PlaceDescAxis::axis(axis)` shared its name with `PlaceDesc`'s extraction, which is now `Index<Axis>` and reads `place[axis]`. The two go opposite directions, so they get different words: `on_axis` pairs with the `from_axis` it is the shorthand for. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2807a925af
commit
4d42f1c8ca
6 files changed
+9
-9
No files matched your search
@@ -50,7 +50,7 @@ impl PlaceDescAxis {
|
|||||||
/// a container dividing one axis says, since nothing divides the other.
|
/// a container dividing one axis says, since nothing divides the other.
|
||||||
/// [`PlaceDesc::from_axis`] says the across one where it is not the
|
/// [`PlaceDesc::from_axis`] says the across one where it is not the
|
||||||
/// whole.
|
/// whole.
|
||||||
pub const fn axis(self, axis: Axis) -> PlaceDesc {
|
pub const fn on_axis(self, axis: Axis) -> PlaceDesc {
|
||||||
PlaceDesc::from_axis(axis, self, Self::WHOLE)
|
PlaceDesc::from_axis(axis, self, Self::WHOLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -120,7 +120,7 @@ impl Widget for Branch {
|
|||||||
let cut = Len::from_parts(Rel::ZERO, Px::from_int(40));
|
let cut = Len::from_parts(Rel::ZERO, Px::from_int(40));
|
||||||
let top = UiSpan::new(Len::ZERO, cut).shifted_desc();
|
let top = UiSpan::new(Len::ZERO, cut).shifted_desc();
|
||||||
let measured = painter
|
let measured = painter
|
||||||
.widget_at(&self.probe, top.axis(Axis::Y))
|
.widget_at(&self.probe, top.on_axis(Axis::Y))
|
||||||
.len(Axis::X);
|
.len(Axis::X);
|
||||||
let len = measured.apply_leftover();
|
let len = measured.apply_leftover();
|
||||||
let px = painter.to_px(len, Axis::X);
|
let px = painter.to_px(len, Axis::X);
|
||||||
@@ -135,7 +135,7 @@ impl Widget for Branch {
|
|||||||
painter.window_holds(Axis::X, holds.through(len));
|
painter.window_holds(Axis::X, holds.through(len));
|
||||||
|
|
||||||
let below = UiSpan::new(cut, painter.region_len(Axis::Y)).shifted_desc();
|
let below = UiSpan::new(cut, painter.region_len(Axis::Y)).shifted_desc();
|
||||||
let place = below.axis(Axis::Y);
|
let place = below.on_axis(Axis::Y);
|
||||||
match px > threshold {
|
match px > threshold {
|
||||||
true => painter.widget_at(&self.wide, place),
|
true => painter.widget_at(&self.wide, place),
|
||||||
false => painter.widget_at(&self.narrow, place),
|
false => painter.widget_at(&self.narrow, place),
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ impl Widget for Scroll {
|
|||||||
// reports is a fraction of what is on screen rather than of the
|
// reports is a fraction of what is on screen rather than of the
|
||||||
// content box its own answer decided. Where it goes is the content
|
// content box its own answer decided. Where it goes is the content
|
||||||
// box, scrolled: its drawing moved there, not made again there.
|
// box, scrolled: its drawing moved there, not made again there.
|
||||||
painter.place_at(&self.inner, content.axis(self.axis).fills());
|
painter.place_at(&self.inner, content.on_axis(self.axis).fills());
|
||||||
// What it occupies is its box, on both axes: it clips its content to
|
// What it occupies is its box, on both axes: it clips its content to
|
||||||
// that box, so it can neither take less of one nor honestly ask for
|
// that box, so it can neither take less of one nor honestly ask for
|
||||||
// more. The content's length is what it scrolls through, not what it
|
// more. The content's length is what it scrolls through, not what it
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ impl Widget for Span {
|
|||||||
// Across itself the child sits where its own alignment
|
// Across itself the child sits where its own alignment
|
||||||
// says, in the whole of the row: a span is what contains
|
// says, in the whole of the row: a span is what contains
|
||||||
// its children there, and nothing divides that axis.
|
// its children there, and nothing divides that axis.
|
||||||
let room = along(cursor, far).shifted_desc().axis(axis);
|
let room = along(cursor, far).shifted_desc().on_axis(axis);
|
||||||
painter.widget_at(child, room).len(axis)
|
painter.widget_at(child, room).len(axis)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -119,7 +119,7 @@ impl Widget for Span {
|
|||||||
// fixed child's slot is its own answer, so a drawing made in the
|
// fixed child's slot is its own answer, so a drawing made in the
|
||||||
// room is put there as it is, and one not made yet is made here.
|
// room is put there as it is, and one not made yet is made here.
|
||||||
let slot = along(from, start);
|
let slot = along(from, start);
|
||||||
let mut place = slot.shifted_desc().fills().axis(axis);
|
let mut place = slot.shifted_desc().fills().on_axis(axis);
|
||||||
if len.leftover > Weight::ZERO && shares {
|
if len.leftover > Weight::ZERO && shares {
|
||||||
place = place.rel_base(axis, slot.len());
|
place = place.rel_base(axis, slot.len());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ impl Widget for BranchesOnMeasurement {
|
|||||||
let cut = Len::from_parts(Rel::ZERO, Px::from_int(40));
|
let cut = Len::from_parts(Rel::ZERO, Px::from_int(40));
|
||||||
let top = UiSpan::new(Len::ZERO, cut).shifted_desc();
|
let top = UiSpan::new(Len::ZERO, cut).shifted_desc();
|
||||||
let measured = painter
|
let measured = painter
|
||||||
.widget_at(&self.probe, top.axis(Axis::Y))
|
.widget_at(&self.probe, top.on_axis(Axis::Y))
|
||||||
.len(Axis::X);
|
.len(Axis::X);
|
||||||
let px = painter.to_px(measured.apply_leftover(), Axis::X);
|
let px = painter.to_px(measured.apply_leftover(), Axis::X);
|
||||||
|
|
||||||
let below = UiSpan::new(cut, painter.region_len(Axis::Y)).shifted_desc();
|
let below = UiSpan::new(cut, painter.region_len(Axis::Y)).shifted_desc();
|
||||||
let place = below.axis(Axis::Y);
|
let place = below.on_axis(Axis::Y);
|
||||||
match px > Px::from_f32(self.threshold) {
|
match px > Px::from_f32(self.threshold) {
|
||||||
true => painter.widget_at(&self.wide, place),
|
true => painter.widget_at(&self.wide, place),
|
||||||
false => painter.widget_at(&self.narrow, place),
|
false => painter.widget_at(&self.narrow, place),
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ impl Widget for FromHint {
|
|||||||
fn draw(&mut self, painter: &mut Painter) -> Size {
|
fn draw(&mut self, painter: &mut Painter) -> Size {
|
||||||
let len = painter.size_hint(&self.inner, Axis::Y).unwrap();
|
let len = painter.size_hint(&self.inner, Axis::Y).unwrap();
|
||||||
let top = UiSpan::new(Len::ZERO, Len::from_parts(Rel::ZERO, len.px));
|
let top = UiSpan::new(Len::ZERO, Len::from_parts(Rel::ZERO, len.px));
|
||||||
painter.widget_at(&self.inner, top.shifted_desc().axis(Axis::Y));
|
painter.widget_at(&self.inner, top.shifted_desc().on_axis(Axis::Y));
|
||||||
Size::LEFTOVER
|
Size::LEFTOVER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user