Track retained layout validity explicitly
This commit is contained in:
1 parent
691e3eb23c
commit
29c7881c8a
25 files changed
+836
-795
No files matched your search
@@ -9,17 +9,17 @@ pub struct MaxSize {
|
||||
impl Widget for MaxSize {
|
||||
fn draw(&mut self, painter: &mut Painter) -> Size {
|
||||
let child = painter.widget(&self.inner).size();
|
||||
let output = painter.output_size();
|
||||
let own = painter.px_size();
|
||||
Size {
|
||||
x: capped(child.x, self.x, output.x),
|
||||
y: capped(child.y, self.y, output.y),
|
||||
x: capped(child.x, self.x, own.x),
|
||||
y: capped(child.y, self.y, own.y),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn capped(len: Len, max: Option<Len>, output: f32) -> Len {
|
||||
fn capped(len: Len, max: Option<Len>, own: f32) -> Len {
|
||||
match max {
|
||||
Some(max) if len.apply_leftover().to_px(output) > max.apply_leftover().to_px(output) => max,
|
||||
Some(max) if len.apply_leftover().to_px(own) > max.apply_leftover().to_px(own) => max,
|
||||
_ => len,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user