From 1d245cc5e8d6da4fe2f6e12b49336d3699583482 Mon Sep 17 00:00:00 2001 From: Per Lindgren <per.lindgren@ltu.se> Date: Sun, 26 Jan 2020 23:22:44 +0100 Subject: [PATCH] ADSR with a viev (padding experiment) --- examples/draw.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/draw.rs b/examples/draw.rs index 3c3bed9..93f6888 100644 --- a/examples/draw.rs +++ b/examples/draw.rs @@ -115,11 +115,9 @@ impl Widget<Envelope> for Draw { _data: &Envelope, _env: &Env, ) -> Size { - // info!("layout bc {:?}", bc); - // info!("layout bc.min {:?}", bc.min()); - - // bc.min() - bc.constrain((100.0, 100.0)) // this is probably incorrect + info!("layout bc {:?}", bc); + info!("layout bc.min {:?}", bc.min()); + bc.constrain((100.0, 100.0)) // this gives a firm size, which is not what I want } fn paint(&mut self, paint_ctx: &mut PaintCtx, data: &Envelope, _env: &Env) { @@ -174,12 +172,14 @@ impl Adsr { Flex::column() .with_child( Draw {} + //.expand() // this would expand to the whole window .lens(Adsr::envelope) .background(solid.clone()) .padding(5.0), 0.0, ) .with_child(Envelope::new().lens(Adsr::envelope).padding(5.0), 0.0) + // .expand() // this gives very strange and erroneous layout } } @@ -190,22 +190,22 @@ fn build_app() -> impl Widget<Adsr> { .with_child( Flex::row() .with_child(Adsr::new().padding(10.0), 0.0) - //.with_child(Adsr::new().expand().padding(10.0), 0.0) + //.with_child(Adsr::new().expand().padding(5.0), 0.0) .with_child( Label::new("top right") .background(solid.clone()) - .padding(10.0), + .padding(5.0), 1.0, ), 1.0, ) .with_child( Flex::row() - .with_child(Label::new("bottom left").padding(10.0), 1.0) + .with_child(Label::new("bottom left").padding(5.0), 1.0) .with_child( Label::new("bottom right") .border(solid.clone(), 4.0) - .padding(10.0), + .padding(5.0), 1.0, ), 1.0, -- GitLab