Stop keeping what nothing reads back
`ActiveData::size_deps` was written on every draw, cleared on every undraw, and read nowhere: a `Vec<WidgetId>` per active widget for a list only the `Painter`'s own copy is used from, in `draw_at`, before the record is built. What it looked like it was for -- reaching a widget whose size was read -- is already done there, by recording whoever asked about a child it did not draw. `SizeRule::apply` had no caller and would have been wrong if it found one: it answers with the rule's own length, where `draw_at` resolves a fraction against the rel base first. One rule, applied in one place. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1ebd4d3a05
commit
aea0387567
3 files changed
-13
No files matched your search
@@ -51,8 +51,6 @@ pub struct ActiveData {
|
|||||||
/// An owned mask holds one reference independently of its primitives.
|
/// An owned mask holds one reference independently of its primitives.
|
||||||
pub mask_region: Option<UiRegion>,
|
pub mask_region: Option<UiRegion>,
|
||||||
pub children: Vec<WidgetId>,
|
pub children: Vec<WidgetId>,
|
||||||
/// The children whose size this widget read while drawing.
|
|
||||||
pub size_deps: Vec<WidgetId>,
|
|
||||||
/// The movable region its primitives are positioned through: its own when
|
/// The movable region its primitives are positioned through: its own when
|
||||||
/// opted in, otherwise the nearest ancestor's.
|
/// opted in, otherwise the nearest ancestor's.
|
||||||
pub move_idx: MoveIdx,
|
pub move_idx: MoveIdx,
|
||||||
|
|||||||
@@ -489,7 +489,6 @@ impl UiRenderState {
|
|||||||
primitives,
|
primitives,
|
||||||
mask_region,
|
mask_region,
|
||||||
children,
|
children,
|
||||||
size_deps,
|
|
||||||
declared: rsc.widgets().declared_lens(id),
|
declared: rsc.widgets().declared_lens(id),
|
||||||
own_align: rsc.widgets().alignment(id),
|
own_align: rsc.widgets().alignment(id),
|
||||||
move_idx,
|
move_idx,
|
||||||
@@ -800,7 +799,6 @@ impl UiRenderState {
|
|||||||
}
|
}
|
||||||
// After the descendants, whose slots name this one as their parent.
|
// After the descendants, whose slots name this one as their parent.
|
||||||
self.drop_slot(id);
|
self.drop_slot(id);
|
||||||
active.size_deps.clear();
|
|
||||||
active.drawn = false;
|
active.drawn = false;
|
||||||
self.active.insert(id, active);
|
self.active.insert(id, active);
|
||||||
}
|
}
|
||||||
@@ -844,7 +842,6 @@ impl UiRenderState {
|
|||||||
primitives: Vec::new(),
|
primitives: Vec::new(),
|
||||||
mask_region: None,
|
mask_region: None,
|
||||||
children: Vec::new(),
|
children: Vec::new(),
|
||||||
size_deps: Vec::new(),
|
|
||||||
move_idx: info.parent_move,
|
move_idx: info.parent_move,
|
||||||
declared: Declared::NONE,
|
declared: Declared::NONE,
|
||||||
own_align: rsc.widgets().alignment(id),
|
own_align: rsc.widgets().alignment(id),
|
||||||
|
|||||||
@@ -36,14 +36,6 @@ impl SizeRule {
|
|||||||
Self::Exact(len) => Some(*len),
|
Self::Exact(len) => Some(*len),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The length a widget reporting `reported` ends up with.
|
|
||||||
pub fn apply(&self, reported: LayoutLen) -> LayoutLen {
|
|
||||||
match self {
|
|
||||||
Self::Free => reported,
|
|
||||||
Self::Exact(len) => *len,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<LayoutLen> for SizeRule {
|
impl From<LayoutLen> for SizeRule {
|
||||||
|
|||||||
Reference in new issue
Block a user