A share child was drawn in the measuring room and again in its slot, and one record holding two questions made every local change under it defer to the span. Where a rule or a hint gives the length along the span, the first ask answers nothing the rule does not, so the child is asked once, in its slot; the widgets that always report the whole of their box now say so. A hint with a fraction resolves against the frame and pins it. The dump rig prints every cold layout so a change to it shows in a diff.
23 lines
744 B
Rust
23 lines
744 B
Rust
use crate::prelude::*;
|
|
|
|
pub struct Masked {
|
|
pub inner: StrongWidget,
|
|
}
|
|
|
|
impl Widget for Masked {
|
|
fn draw(&mut self, painter: &mut Painter) -> Size {
|
|
painter.set_mask(UiRegion::FULL);
|
|
painter.widget(&self.inner);
|
|
// What it occupies is its box, on both axes, for the reason `Scroll`
|
|
// reports the same: it clips what is inside to that box, so it can
|
|
// neither take less of one nor honestly ask for more. Passing the
|
|
// inner size up instead asks to be placed at a length it does not
|
|
// draw, and the framework would place the drawing it clipped away.
|
|
Size::LEFTOVER
|
|
}
|
|
|
|
fn size_hint(&self, _: Axis) -> Option<LayoutLen> {
|
|
Some(LayoutLen::LEFTOVER)
|
|
}
|
|
}
|