diff options
author | 2020-04-14 06:49:15 +0200 | |
---|---|---|
committer | 2020-04-14 06:49:15 +0200 | |
commit | c545af35773307d16eca7ec03ed4794f26491da2 (patch) | |
tree | c8bdb7f54cfbdaaeec079ade9c9ea991f38f0c20 /examples/solar_system | |
parent | 5c923fce4866bcda0d2d2c1023bb046cd92038cc (diff) | |
download | iced-c545af35773307d16eca7ec03ed4794f26491da2.tar.gz iced-c545af35773307d16eca7ec03ed4794f26491da2.tar.bz2 iced-c545af35773307d16eca7ec03ed4794f26491da2.zip |
Implement `canvas::Path::rectangle` helper method
Diffstat (limited to 'examples/solar_system')
-rw-r--r-- | examples/solar_system/src/main.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs index d2c6e38f..067f8ff2 100644 --- a/examples/solar_system/src/main.rs +++ b/examples/solar_system/src/main.rs @@ -133,9 +133,7 @@ impl canvas::Drawable for State { let center = frame.center(); - let space = Path::new(|path| { - path.rectangle(Point::new(0.0, 0.0), frame.size()) - }); + let space = Path::rectangle(Point::new(0.0, 0.0), frame.size()); let stars = Path::new(|path| { for (p, size) in &self.stars { @@ -174,15 +172,10 @@ impl canvas::Drawable for State { path.circle(Point::ORIGIN, Self::EARTH_RADIUS) }); - let shadow = Path::new(|path| { - path.rectangle( - Point::new(0.0, -Self::EARTH_RADIUS), - Size::new( - Self::EARTH_RADIUS * 4.0, - Self::EARTH_RADIUS * 2.0, - ), - ) - }); + let shadow = Path::rectangle( + Point::new(0.0, -Self::EARTH_RADIUS), + Size::new(Self::EARTH_RADIUS * 4.0, Self::EARTH_RADIUS * 2.0), + ); frame.fill(&earth, Color::from_rgb8(0x6B, 0x93, 0xD6)); |