Refactor imports in solar_system example

This commit is contained in:
Héctor Ramón Jiménez 2022-11-03 05:19:58 +01:00
parent d8045e2dc3
commit e07344428d
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -11,9 +11,9 @@ use iced::executor;
use iced::theme::{self, Theme}; use iced::theme::{self, Theme};
use iced::time; use iced::time;
use iced::widget::canvas; use iced::widget::canvas;
use iced::widget::canvas::{ use iced::widget::canvas::gradient::{self, Gradient};
gradient::Position, stroke, Cursor, Gradient, Path, Stroke, use iced::widget::canvas::stroke::{self, Stroke};
}; use iced::widget::canvas::{Cursor, Path};
use iced::window; use iced::window;
use iced::{ use iced::{
Application, Color, Command, Element, Length, Point, Rectangle, Settings, Application, Color, Command, Element, Length, Point, Rectangle, Settings,
@ -203,14 +203,15 @@ impl<Message> canvas::Program<Message> for State {
let earth = Path::circle(Point::ORIGIN, Self::EARTH_RADIUS); let earth = Path::circle(Point::ORIGIN, Self::EARTH_RADIUS);
let earth_fill = Gradient::linear(Position::Absolute { let earth_fill =
start: Point::new(-Self::EARTH_RADIUS, 0.0), Gradient::linear(gradient::Position::Absolute {
end: Point::new(Self::EARTH_RADIUS, 0.0), start: Point::new(-Self::EARTH_RADIUS, 0.0),
}) end: Point::new(Self::EARTH_RADIUS, 0.0),
.add_stop(0.2, Color::from_rgb(0.15, 0.50, 1.0)) })
.add_stop(0.8, Color::from_rgb(0.0, 0.20, 0.47)) .add_stop(0.2, Color::from_rgb(0.15, 0.50, 1.0))
.build() .add_stop(0.8, Color::from_rgb(0.0, 0.20, 0.47))
.unwrap(); .build()
.expect("Build Earth fill gradient");
frame.fill(&earth, &earth_fill); frame.fill(&earth, &earth_fill);