Merge branch 'master' into theming

This commit is contained in:
Héctor Ramón Jiménez 2022-07-08 19:31:45 +02:00
commit fa55dff61d
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
34 changed files with 444 additions and 337 deletions

View file

@ -73,6 +73,10 @@ impl Application for SolarSystem {
.height(Length::Fill)
.into()
}
fn theme(&self) -> Theme {
Theme::Dark
}
}
#[derive(Debug)]
@ -142,16 +146,12 @@ impl<Message> canvas::Program<Message> for State {
use std::f32::consts::PI;
let background = self.space_cache.draw(bounds.size(), |frame| {
let space = Path::rectangle(Point::new(0.0, 0.0), frame.size());
let stars = Path::new(|path| {
for (p, size) in &self.stars {
path.rectangle(*p, Size::new(*size, *size));
}
});
frame.fill(&space, Color::BLACK);
frame.translate(frame.center() - Point::ORIGIN);
frame.fill(&stars, Color::WHITE);
});