diff options
| author | 2019-12-07 07:46:31 +0100 | |
|---|---|---|
| committer | 2019-12-07 07:46:31 +0100 | |
| commit | f5d316490898d4a5a27d9f5f9bb68796f5278c70 (patch) | |
| tree | a4e463bc1d43adf6083a3a569ebc090abdfc3310 /examples | |
| parent | 749722fca6eb9c85901e80060583559317f2af79 (diff) | |
| download | iced-f5d316490898d4a5a27d9f5f9bb68796f5278c70.tar.gz iced-f5d316490898d4a5a27d9f5f9bb68796f5278c70.tar.bz2 iced-f5d316490898d4a5a27d9f5f9bb68796f5278c70.zip | |
Simplify `custom_widget` example
Diffstat (limited to '')
| -rw-r--r-- | examples/custom_widget.rs | 16 | 
1 files changed, 6 insertions, 10 deletions
| diff --git a/examples/custom_widget.rs b/examples/custom_widget.rs index d51753e2..cf2f7792 100644 --- a/examples/custom_widget.rs +++ b/examples/custom_widget.rs @@ -37,14 +37,12 @@ mod circle {          fn layout(              &self,              _renderer: &Renderer, -            limits: &layout::Limits, +            _limits: &layout::Limits,          ) -> layout::Node { -            let size = limits -                .width(Length::Units(self.radius * 2)) -                .height(Length::Units(self.radius * 2)) -                .resolve(Size::ZERO); - -            layout::Node::new(size) +            layout::Node::new(Size::new( +                f32::from(self.radius) * 2.0, +                f32::from(self.radius) * 2.0, +            ))          }          fn hash_layout(&self, state: &mut Hasher) { @@ -59,11 +57,9 @@ mod circle {              layout: Layout<'_>,              _cursor_position: Point,          ) -> (Primitive, MouseCursor) { -            let bounds = layout.bounds(); -              (                  Primitive::Quad { -                    bounds, +                    bounds: layout.bounds(),                      background: Background::Color(Color::BLACK),                      border_radius: self.radius,                  }, | 
