Call the record's boxes what they are
The offer names are from the protocol before this one, where a widget was drawn twice and the record had to say which drawing was the question. It is asked once now, so offer_part is the part it was asked in, offer_place the place it was asked at, and place where its drawing was put: part, asked and placed. LayoutHolds::frame is a range on the window since the frame became a length of one, and the frame's own entry is the frame_len pin beside it, so it is window; Painter::frame_own goes with it. answers_at had one caller and said less than the line that replaces it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
adbedaf264
commit
a30971e4c5
6 files changed
+67
-71
No files matched your search
+9
-19
@@ -19,17 +19,17 @@ pub struct ActiveData {
|
|||||||
/// forwards the parent's frame. What it declared is kept separately in
|
/// forwards the parent's frame. What it declared is kept separately in
|
||||||
/// `declared` and is a fraction of whichever of the two reached it.
|
/// `declared` and is a fraction of whichever of the two reached it.
|
||||||
pub narrow: [Option<Len>; 2],
|
pub narrow: [Option<Len>; 2],
|
||||||
/// Where its drawing was put, as a part of its parent's box, and where
|
/// Where its drawing was put, and where it was asked, each as a part of
|
||||||
/// it was asked. The two differ where a container asks in one place and
|
/// its parent's box. The two differ where a container asks in one place
|
||||||
/// places the answer in another -- a row measures from its cursor and
|
/// and puts the answer in another -- a row measures from its cursor and
|
||||||
/// puts the child in its slot. A part is a length from the box's start,
|
/// puts the child in its slot. A part is a length from the box's start,
|
||||||
/// so a box that moved re-places every child by re-adding that start.
|
/// so a box that moved re-places every child by re-adding that start.
|
||||||
pub place: [Place; 2],
|
pub placed: [Place; 2],
|
||||||
pub offer_place: [Place; 2],
|
pub asked: [Place; 2],
|
||||||
/// The box it was asked in, in the parent's region-node coordinates: the
|
/// The box it was asked in, in the parent's region-node coordinates: the
|
||||||
/// box its drawing was made in and the one its contract is about. Its
|
/// box its drawing was made in and the one its contract is about. Its
|
||||||
/// drawing is placed elsewhere by re-expression, never by asking again.
|
/// drawing is placed elsewhere by re-expression, never by asking again.
|
||||||
pub offer_part: UiRegion,
|
pub part: UiRegion,
|
||||||
/// The measured answer and its dependencies. A hint-only dependency or
|
/// The measured answer and its dependencies. A hint-only dependency or
|
||||||
/// a widget first encountered during placement has no measurement yet.
|
/// a widget first encountered during placement has no measurement yet.
|
||||||
pub answer: Option<(Size, LayoutHolds)>,
|
pub answer: Option<(Size, LayoutHolds)>,
|
||||||
@@ -82,20 +82,10 @@ pub struct ActiveData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveData {
|
impl ActiveData {
|
||||||
/// What it answered when its parent measured it, where it has been
|
/// What it answered when its parent asked, where it has been asked at
|
||||||
/// measured at all. Not `size`, which is what its last drawing reported:
|
/// all. Not `size`, which is what its last drawing reported: a drawing
|
||||||
/// a drawing made in the box that answer chose is answering a different
|
/// re-expressed in the box that answer chose is not a second answer.
|
||||||
/// question.
|
|
||||||
pub fn measured(&self) -> Option<Size> {
|
pub fn measured(&self) -> Option<Size> {
|
||||||
self.answer.map(|(size, _)| size)
|
self.answer.map(|(size, _)| size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether what it answered still stands in this window, for the frame
|
|
||||||
/// and the box it was asked in. The answer was given in the box its
|
|
||||||
/// parent first asked about, which is what it is checked against --
|
|
||||||
/// `holds` on the record is about the box the answer then chose.
|
|
||||||
pub fn answers_at(&self, window: crate::PxVec2, part: UiRegion) -> bool {
|
|
||||||
self.answer
|
|
||||||
.is_some_and(|(_, holds)| holds.contains(window, self.frame, part))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ const AXES: [Axis; 2] = [Axis::X, Axis::Y];
|
|||||||
/// whatever the frame turns out to be.
|
/// whatever the frame turns out to be.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
pub struct LayoutHolds {
|
pub struct LayoutHolds {
|
||||||
pub frame: [Holds; 2],
|
pub window: [Holds; 2],
|
||||||
pub frame_len: [Option<Len>; 2],
|
pub frame_len: [Option<Len>; 2],
|
||||||
pub extent: [Holds; 2],
|
pub extent: [Holds; 2],
|
||||||
pub extent_len: [Option<Len>; 2],
|
pub extent_len: [Option<Len>; 2],
|
||||||
@@ -28,7 +28,7 @@ pub struct LayoutHolds {
|
|||||||
|
|
||||||
impl LayoutHolds {
|
impl LayoutHolds {
|
||||||
pub const ANY: Self = Self {
|
pub const ANY: Self = Self {
|
||||||
frame: [Holds::ANY; 2],
|
window: [Holds::ANY; 2],
|
||||||
frame_len: [None; 2],
|
frame_len: [None; 2],
|
||||||
extent: [Holds::ANY; 2],
|
extent: [Holds::ANY; 2],
|
||||||
extent_len: [None; 2],
|
extent_len: [None; 2],
|
||||||
@@ -37,7 +37,7 @@ impl LayoutHolds {
|
|||||||
pub fn and(self, other: Self) -> Self {
|
pub fn and(self, other: Self) -> Self {
|
||||||
let mut result = Self::ANY;
|
let mut result = Self::ANY;
|
||||||
for n in 0..2 {
|
for n in 0..2 {
|
||||||
result.frame[n] = self.frame[n].and(other.frame[n]);
|
result.window[n] = self.window[n].and(other.window[n]);
|
||||||
result.extent[n] = self.extent[n].and(other.extent[n]);
|
result.extent[n] = self.extent[n].and(other.extent[n]);
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
self.extent_len[n].is_none()
|
self.extent_len[n].is_none()
|
||||||
@@ -57,8 +57,8 @@ impl LayoutHolds {
|
|||||||
|
|
||||||
pub fn covers(self, other: Self) -> bool {
|
pub fn covers(self, other: Self) -> bool {
|
||||||
(0..2).all(|n| {
|
(0..2).all(|n| {
|
||||||
self.frame[n].lo <= other.frame[n].lo
|
self.window[n].lo <= other.window[n].lo
|
||||||
&& self.frame[n].hi >= other.frame[n].hi
|
&& self.window[n].hi >= other.window[n].hi
|
||||||
&& self.extent[n].lo <= other.extent[n].lo
|
&& self.extent[n].lo <= other.extent[n].lo
|
||||||
&& self.extent[n].hi >= other.extent[n].hi
|
&& self.extent[n].hi >= other.extent[n].hi
|
||||||
&& self.extent_len[n].is_none_or(|len| other.extent_len[n] == Some(len))
|
&& self.extent_len[n].is_none_or(|len| other.extent_len[n] == Some(len))
|
||||||
@@ -70,7 +70,7 @@ impl LayoutHolds {
|
|||||||
AXES.into_iter().all(|axis| {
|
AXES.into_iter().all(|axis| {
|
||||||
let n = axis as usize;
|
let n = axis as usize;
|
||||||
let len = extent.axis(axis).len();
|
let len = extent.axis(axis).len();
|
||||||
self.frame[n].contains(window.axis(axis))
|
self.window[n].contains(window.axis(axis))
|
||||||
&& self.frame_len[n].is_none_or(|pinned| pinned == frame.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[n].contains(len.to_px(window.axis(axis)))
|
||||||
&& self.extent_len[n].is_none_or(|pinned| pinned == len)
|
&& self.extent_len[n].is_none_or(|pinned| pinned == len)
|
||||||
|
|||||||
+12
-10
@@ -42,7 +42,7 @@ pub struct Painter<'a> {
|
|||||||
pub(super) size_deps: Vec<WidgetId>,
|
pub(super) size_deps: Vec<WidgetId>,
|
||||||
/// What this draw itself read of the window in pixels, per axis: every
|
/// What this draw itself read of the window in pixels, per axis: every
|
||||||
/// window until it reads one, then that one, unless it says otherwise.
|
/// window until it reads one, then that one, unless it says otherwise.
|
||||||
pub(super) frame_own: [Holds; 2],
|
pub(super) window_own: [Holds; 2],
|
||||||
/// Its frame's symbolic length where this draw read it, which makes the
|
/// Its frame's symbolic length where this draw read it, which makes the
|
||||||
/// drawing one that holds for that frame alone.
|
/// drawing one that holds for that frame alone.
|
||||||
pub(super) frame_own_len: [Option<Len>; 2],
|
pub(super) frame_own_len: [Option<Len>; 2],
|
||||||
@@ -192,8 +192,8 @@ impl<'a> Painter<'a> {
|
|||||||
mask: self.mask,
|
mask: self.mask,
|
||||||
frame,
|
frame,
|
||||||
part: extent,
|
part: extent,
|
||||||
place,
|
placed: place,
|
||||||
offer_place: place,
|
asked: place,
|
||||||
narrow,
|
narrow,
|
||||||
re_asked,
|
re_asked,
|
||||||
px,
|
px,
|
||||||
@@ -429,7 +429,7 @@ impl<'a> Painter<'a> {
|
|||||||
pub fn to_px(&mut self, len: Len, axis: Axis) -> Px {
|
pub fn to_px(&mut self, len: Len, axis: Axis) -> Px {
|
||||||
let window = self.window.axis(axis);
|
let window = self.window.axis(axis);
|
||||||
if len.rel != Rel::ZERO {
|
if len.rel != Rel::ZERO {
|
||||||
let own = &mut self.frame_own[axis as usize];
|
let own = &mut self.window_own[axis as usize];
|
||||||
if *own == Holds::ANY {
|
if *own == Holds::ANY {
|
||||||
*own = Holds::at(window);
|
*own = Holds::at(window);
|
||||||
}
|
}
|
||||||
@@ -437,8 +437,10 @@ impl<'a> Painter<'a> {
|
|||||||
len.to_px(window)
|
len.to_px(window)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A validity range already stated about the window. Containers use
|
/// The windows this drawing holds for, stated rather than taken: a
|
||||||
/// this after branching on a window-unit length.
|
/// container that branched on a length in pixels says which side of the
|
||||||
|
/// boundary it was on, which is wider than the one window reading that
|
||||||
|
/// length pins, and replaces it.
|
||||||
pub fn window_holds(&mut self, axis: Axis, holds: impl Into<Holds>) {
|
pub fn window_holds(&mut self, axis: Axis, holds: impl Into<Holds>) {
|
||||||
let holds = holds.into();
|
let holds = holds.into();
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
@@ -447,7 +449,7 @@ impl<'a> Painter<'a> {
|
|||||||
self.label(),
|
self.label(),
|
||||||
self.id
|
self.id
|
||||||
);
|
);
|
||||||
self.frame_own[axis as usize] = holds;
|
self.window_own[axis as usize] = holds;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn text_data(&mut self) -> &mut TextData {
|
pub fn text_data(&mut self) -> &mut TextData {
|
||||||
@@ -563,7 +565,7 @@ impl Painter<'_> {
|
|||||||
let n = axis as usize;
|
let n = axis as usize;
|
||||||
// Every frame range is already a range on the window: the
|
// Every frame range is already a range on the window: the
|
||||||
// widget's own read converted through its frame exactly once.
|
// widget's own read converted through its frame exactly once.
|
||||||
result.frame[n] = holds.frame[n];
|
result.window[n] = holds.window[n];
|
||||||
let reaches = narrow[n].is_none()
|
let reaches = narrow[n].is_none()
|
||||||
&& !matches!(place[n].part(), Part::Sized(_))
|
&& !matches!(place[n].part(), Part::Sized(_))
|
||||||
&& declared[n].is_none_or(|len| len.rel != Rel::ZERO);
|
&& declared[n].is_none_or(|len| len.rel != Rel::ZERO);
|
||||||
@@ -599,8 +601,8 @@ impl Painter<'_> {
|
|||||||
// it, so what it holds for is a range on the frame and none
|
// it, so what it holds for is a range on the frame and none
|
||||||
// of it on this widget's own box.
|
// of it on this widget's own box.
|
||||||
_ => {
|
_ => {
|
||||||
result.frame[n] =
|
result.window[n] =
|
||||||
result.frame[n].and(holds.extent[n].through(extent.axis(axis).len()));
|
result.window[n].and(holds.extent[n].through(extent.axis(axis).len()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-33
@@ -28,9 +28,9 @@ pub(super) struct DrawInfo {
|
|||||||
pub part: UiRegion,
|
pub part: UiRegion,
|
||||||
/// Where the widget is put, and where it was asked, as parts of the
|
/// Where the widget is put, and where it was asked, as parts of the
|
||||||
/// parent's box. See [`Place`]. The two are one ask's place until the
|
/// parent's box. See [`Place`]. The two are one ask's place until the
|
||||||
/// parent places the answer somewhere else.
|
/// parent puts the answer somewhere else.
|
||||||
pub place: [Place; 2],
|
pub placed: [Place; 2],
|
||||||
pub offer_place: [Place; 2],
|
pub asked: [Place; 2],
|
||||||
/// A frame the parent decided for it on each axis, as a length of the
|
/// A frame the parent decided for it on each axis, as a length of the
|
||||||
/// window, which the widget's own declaration is a fraction of.
|
/// window, which the widget's own declaration is a fraction of.
|
||||||
pub narrow: [Option<Len>; 2],
|
pub narrow: [Option<Len>; 2],
|
||||||
@@ -44,7 +44,7 @@ impl DrawInfo {
|
|||||||
/// The axes where the part is the drawing's box outright, which are the
|
/// The axes where the part is the drawing's box outright, which are the
|
||||||
/// axes the answer is not placed inside it again.
|
/// axes the answer is not placed inside it again.
|
||||||
fn fill(&self) -> [bool; 2] {
|
fn fill(&self) -> [bool; 2] {
|
||||||
self.place.map(Place::fills)
|
self.placed.map(Place::fills)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,9 +120,13 @@ impl UiRenderState {
|
|||||||
let Some(root) = self.old_root else { return };
|
let Some(root) = self.old_root else { return };
|
||||||
let stands = self.active.get(&root).is_some_and(|active| {
|
let stands = self.active.get(&root).is_some_and(|active| {
|
||||||
// Nothing above the root chose anything, so the box it was first
|
// Nothing above the root chose anything, so the box it was first
|
||||||
// asked about is the whole of its frame.
|
// asked about is the whole of its frame. Both its answer and its
|
||||||
active.answers_at(size, active.offer_part)
|
// drawing have to stand in the new window, since nothing above
|
||||||
&& active.holds.contains(size, active.frame, active.offer_part)
|
// it will ask either again.
|
||||||
|
let answer = active
|
||||||
|
.answer
|
||||||
|
.is_some_and(|(_, holds)| holds.contains(size, active.frame, active.part));
|
||||||
|
answer && active.holds.contains(size, active.frame, active.part)
|
||||||
});
|
});
|
||||||
if !stands {
|
if !stands {
|
||||||
widgets.needs_redraw.insert(root);
|
widgets.needs_redraw.insert(root);
|
||||||
@@ -142,8 +146,8 @@ impl UiRenderState {
|
|||||||
mask: MaskIdx::NONE,
|
mask: MaskIdx::NONE,
|
||||||
frame,
|
frame,
|
||||||
part: extent,
|
part: extent,
|
||||||
place: [Place::Within(Part::All); 2],
|
placed: [Place::Within(Part::All); 2],
|
||||||
offer_place: [Place::Within(Part::All); 2],
|
asked: [Place::Within(Part::All); 2],
|
||||||
narrow: [None; 2],
|
narrow: [None; 2],
|
||||||
re_asked: false,
|
re_asked: false,
|
||||||
px,
|
px,
|
||||||
@@ -267,9 +271,9 @@ impl UiRenderState {
|
|||||||
active.narrow = info.narrow;
|
active.narrow = info.narrow;
|
||||||
active.re_asked = info.re_asked;
|
active.re_asked = info.re_asked;
|
||||||
active.answer = Some(answer);
|
active.answer = Some(answer);
|
||||||
active.offer_place = info.offer_place;
|
active.asked = info.asked;
|
||||||
active.offer_part = part;
|
active.part = part;
|
||||||
active.place = info.place;
|
active.placed = info.placed;
|
||||||
active.own_align = align;
|
active.own_align = align;
|
||||||
// A subtree can be reused whole under a different parent -- same box,
|
// A subtree can be reused whole under a different parent -- same box,
|
||||||
// same layer, same region node -- and nothing in the drawing says it
|
// same layer, same region node -- and nothing in the drawing says it
|
||||||
@@ -328,7 +332,7 @@ impl UiRenderState {
|
|||||||
mask_region: None,
|
mask_region: None,
|
||||||
children: Vec::new(),
|
children: Vec::new(),
|
||||||
size_deps: Vec::new(),
|
size_deps: Vec::new(),
|
||||||
frame_own: [Holds::ANY; 2],
|
window_own: [Holds::ANY; 2],
|
||||||
frame_own_len: [None; 2],
|
frame_own_len: [None; 2],
|
||||||
under: Vec::new(),
|
under: Vec::new(),
|
||||||
extent_own: [Holds::ANY; 2],
|
extent_own: [Holds::ANY; 2],
|
||||||
@@ -364,7 +368,7 @@ impl UiRenderState {
|
|||||||
answer_under,
|
answer_under,
|
||||||
children,
|
children,
|
||||||
size_deps,
|
size_deps,
|
||||||
frame_own,
|
window_own,
|
||||||
frame_own_len,
|
frame_own_len,
|
||||||
under,
|
under,
|
||||||
move_idx,
|
move_idx,
|
||||||
@@ -435,7 +439,7 @@ impl UiRenderState {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
let own_holds = LayoutHolds {
|
let own_holds = LayoutHolds {
|
||||||
frame: frame_own,
|
window: window_own,
|
||||||
frame_len,
|
frame_len,
|
||||||
extent: extent_own,
|
extent: extent_own,
|
||||||
extent_len,
|
extent_len,
|
||||||
@@ -465,8 +469,8 @@ impl UiRenderState {
|
|||||||
mask,
|
mask,
|
||||||
frame: UiVec2::FULL_SIZE,
|
frame: UiVec2::FULL_SIZE,
|
||||||
part: UiRegion::FULL,
|
part: UiRegion::FULL,
|
||||||
place: [Place::Within(Part::All); 2],
|
placed: [Place::Within(Part::All); 2],
|
||||||
offer_place: [Place::Within(Part::All); 2],
|
asked: [Place::Within(Part::All); 2],
|
||||||
narrow: [None; 2],
|
narrow: [None; 2],
|
||||||
re_asked: false,
|
re_asked: false,
|
||||||
px,
|
px,
|
||||||
@@ -482,9 +486,9 @@ impl UiRenderState {
|
|||||||
extent,
|
extent,
|
||||||
frame: info.frame,
|
frame: info.frame,
|
||||||
narrow: info.narrow,
|
narrow: info.narrow,
|
||||||
place: info.place,
|
placed: info.placed,
|
||||||
offer_place: info.offer_place,
|
asked: info.asked,
|
||||||
offer_part: extent,
|
part: extent,
|
||||||
// Whoever asked writes the answer.
|
// Whoever asked writes the answer.
|
||||||
answer: None,
|
answer: None,
|
||||||
re_asked: info.re_asked,
|
re_asked: info.re_asked,
|
||||||
@@ -626,7 +630,7 @@ impl UiRenderState {
|
|||||||
if holds.extent_len[n].is_some_and(|pinned| pinned != part.axis(axis).len()) {
|
if holds.extent_len[n].is_some_and(|pinned| pinned != part.axis(axis).len()) {
|
||||||
diag::bump(Counter::OutsidePinnedLen);
|
diag::bump(Counter::OutsidePinnedLen);
|
||||||
}
|
}
|
||||||
if !holds.frame[n].contains(self.output_size.axis(axis))
|
if !holds.window[n].contains(self.output_size.axis(axis))
|
||||||
|| holds.frame_len[n].is_some_and(|pinned| pinned != info.frame.axis(axis))
|
|| holds.frame_len[n].is_some_and(|pinned| pinned != info.frame.axis(axis))
|
||||||
{
|
{
|
||||||
diag::bump(Counter::OutsideFrame);
|
diag::bump(Counter::OutsideFrame);
|
||||||
@@ -672,7 +676,7 @@ impl UiRenderState {
|
|||||||
self.redepth(id, info.depth);
|
self.redepth(id, info.depth);
|
||||||
let active = self.active.get_mut(&id).unwrap();
|
let active = self.active.get_mut(&id).unwrap();
|
||||||
active.frame = info.frame;
|
active.frame = info.frame;
|
||||||
active.place = info.place;
|
active.placed = info.placed;
|
||||||
#[cfg(feature = "layout-diagnostics")]
|
#[cfg(feature = "layout-diagnostics")]
|
||||||
{
|
{
|
||||||
match (moved, has_region_node) {
|
match (moved, has_region_node) {
|
||||||
@@ -697,7 +701,7 @@ impl UiRenderState {
|
|||||||
|
|
||||||
/// Places one child of `at.id` where that widget's own box now has it.
|
/// Places one child of `at.id` where that widget's own box now has it.
|
||||||
fn place_child(&mut self, child: WidgetId, at: &Placing, rsc: &mut dyn UiRsc) {
|
fn place_child(&mut self, child: WidgetId, at: &Placing, rsc: &mut dyn UiRsc) {
|
||||||
let place = self.active[&child].place;
|
let place = self.active[&child].placed;
|
||||||
self.place_in(child, at, place, rsc);
|
self.place_in(child, at, place, rsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -729,8 +733,8 @@ impl UiRenderState {
|
|||||||
mask: at.mask,
|
mask: at.mask,
|
||||||
frame,
|
frame,
|
||||||
part,
|
part,
|
||||||
place,
|
placed: place,
|
||||||
offer_place: active.offer_place,
|
asked: active.asked,
|
||||||
narrow: active.narrow,
|
narrow: active.narrow,
|
||||||
re_asked: active.re_asked,
|
re_asked: active.re_asked,
|
||||||
px: frame.to_px(at.window),
|
px: frame.to_px(at.window),
|
||||||
@@ -874,9 +878,9 @@ impl UiRenderState {
|
|||||||
extent: UiRegion::FULL,
|
extent: UiRegion::FULL,
|
||||||
frame: UiVec2::FULL_SIZE,
|
frame: UiVec2::FULL_SIZE,
|
||||||
narrow: [None; 2],
|
narrow: [None; 2],
|
||||||
place: [Place::Within(Part::All); 2],
|
placed: [Place::Within(Part::All); 2],
|
||||||
offer_place: [Place::Within(Part::All); 2],
|
asked: [Place::Within(Part::All); 2],
|
||||||
offer_part: UiRegion::FULL,
|
part: UiRegion::FULL,
|
||||||
answer: None,
|
answer: None,
|
||||||
re_asked: false,
|
re_asked: false,
|
||||||
size,
|
size,
|
||||||
@@ -1113,14 +1117,14 @@ impl UiRenderState {
|
|||||||
self.draw_inner(id, info, old, rsc);
|
self.draw_inner(id, info, old, rsc);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
let (was_answer, was_holds, was_place) = (active.answer, active.holds, active.place);
|
let (was_answer, was_holds, was_place) = (active.answer, active.holds, active.placed);
|
||||||
// The question its parent asked, asked again: the same place of the
|
// The question its parent asked, asked again: the same place of the
|
||||||
// box the parent was asked in, which is the box the parent's own
|
// box the parent was asked in, which is the box the parent's own
|
||||||
// draw ran in and what its children's parts are of. Where the
|
// draw ran in and what its children's parts are of. Where the
|
||||||
// parent's answer put its own drawing is not a question anybody
|
// parent's answer put its own drawing is not a question anybody
|
||||||
// asked, and nothing is asked in it here either.
|
// asked, and nothing is asked in it here either.
|
||||||
let asked = self.placing_of(parent, self.active[&parent].offer_part);
|
let parent_at = self.placing_of(parent, self.active[&parent].part);
|
||||||
let (frame, part) = Self::ask_again(active, &asked, active.offer_place);
|
let (frame, part) = Self::ask_again(active, &parent_at, active.asked);
|
||||||
let info = DrawInfo {
|
let info = DrawInfo {
|
||||||
layer: active.layer,
|
layer: active.layer,
|
||||||
parent: active.parent,
|
parent: active.parent,
|
||||||
@@ -1130,8 +1134,8 @@ impl UiRenderState {
|
|||||||
mask: active.parent_mask,
|
mask: active.parent_mask,
|
||||||
frame,
|
frame,
|
||||||
part,
|
part,
|
||||||
place: active.offer_place,
|
placed: active.asked,
|
||||||
offer_place: active.offer_place,
|
asked: active.asked,
|
||||||
narrow: active.narrow,
|
narrow: active.narrow,
|
||||||
re_asked: false,
|
re_asked: false,
|
||||||
px: frame.to_px(self.output_size),
|
px: frame.to_px(self.output_size),
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ fn padding_keeps_the_frame_distinct_from_the_room_left_in_a_row() {
|
|||||||
h.set_root((icon, padded).span(Dir::RIGHT).width(rel(1.0)));
|
h.set_root((icon, padded).span(Dir::RIGHT).width(rel(1.0)));
|
||||||
let active = &h.render.active[&text.id()];
|
let active = &h.render.active[&text.id()];
|
||||||
let window = h.render.output_size().x;
|
let window = h.render.output_size().x;
|
||||||
let asked = active.offer_part.x.len().to_px(window);
|
let asked = active.part.x.len().to_px(window);
|
||||||
assert_eq!(active.frame.x.to_px(window), Px::from_int(868));
|
assert_eq!(active.frame.x.to_px(window), Px::from_int(868));
|
||||||
assert_eq!(asked, Px::from_int(844));
|
assert_eq!(asked, Px::from_int(844));
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ fn padding_narrows_both_frame_and_box_inside_a_share() {
|
|||||||
let active = &h.render.active[&text.id()];
|
let active = &h.render.active[&text.id()];
|
||||||
let window = h.render.output_size().x;
|
let window = h.render.output_size().x;
|
||||||
assert_eq!(active.frame.x.to_px(window), Px::from_int(418));
|
assert_eq!(active.frame.x.to_px(window), Px::from_int(418));
|
||||||
assert_eq!(active.offer_part.x.len().to_px(window), Px::from_int(418));
|
assert_eq!(active.part.x.len().to_px(window), Px::from_int(418));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ fn record(id: WidgetId, h: &Harness) -> String {
|
|||||||
let active = &h.render.active[&id];
|
let active = &h.render.active[&id];
|
||||||
format!(
|
format!(
|
||||||
"frame {} ask {} box {} size {}",
|
"frame {} ask {} box {} size {}",
|
||||||
active.frame, active.offer_part, active.extent, active.size,
|
active.frame, active.part, active.extent, active.size,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user