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
|
||||
/// `declared` and is a fraction of whichever of the two reached it.
|
||||
pub narrow: [Option<Len>; 2],
|
||||
/// Where its drawing was put, as a part of its parent's box, and where
|
||||
/// it was asked. The two differ where a container asks in one place and
|
||||
/// places the answer in another -- a row measures from its cursor and
|
||||
/// Where its drawing was put, and where it was asked, each as a part of
|
||||
/// its parent's box. The two differ where a container asks in one place
|
||||
/// 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,
|
||||
/// so a box that moved re-places every child by re-adding that start.
|
||||
pub place: [Place; 2],
|
||||
pub offer_place: [Place; 2],
|
||||
pub placed: [Place; 2],
|
||||
pub asked: [Place; 2],
|
||||
/// 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
|
||||
/// 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
|
||||
/// a widget first encountered during placement has no measurement yet.
|
||||
pub answer: Option<(Size, LayoutHolds)>,
|
||||
@@ -82,20 +82,10 @@ pub struct ActiveData {
|
||||
}
|
||||
|
||||
impl ActiveData {
|
||||
/// What it answered when its parent measured it, where it has been
|
||||
/// measured at all. Not `size`, which is what its last drawing reported:
|
||||
/// a drawing made in the box that answer chose is answering a different
|
||||
/// question.
|
||||
/// What it answered when its parent asked, where it has been asked at
|
||||
/// all. Not `size`, which is what its last drawing reported: a drawing
|
||||
/// re-expressed in the box that answer chose is not a second answer.
|
||||
pub fn measured(&self) -> Option<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))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user