Use Palette consistently in arc example
This commit is contained in:
parent
1454bcda4c
commit
3a26a8ccd4
1 changed files with 4 additions and 6 deletions
|
|
@ -5,9 +5,7 @@ use iced::pure::widget::canvas::{
|
||||||
self, Cache, Canvas, Cursor, Geometry, Path, Stroke,
|
self, Cache, Canvas, Cursor, Geometry, Path, Stroke,
|
||||||
};
|
};
|
||||||
use iced::pure::{Application, Element};
|
use iced::pure::{Application, Element};
|
||||||
use iced::{
|
use iced::{Command, Length, Point, Rectangle, Settings, Subscription, Theme};
|
||||||
Color, Command, Length, Point, Rectangle, Settings, Subscription, Theme,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn main() -> iced::Result {
|
pub fn main() -> iced::Result {
|
||||||
Arc::run(Settings {
|
Arc::run(Settings {
|
||||||
|
|
@ -80,6 +78,8 @@ impl<Message> canvas::Program<Message> for Arc {
|
||||||
_cursor: Cursor,
|
_cursor: Cursor,
|
||||||
) -> Vec<Geometry> {
|
) -> Vec<Geometry> {
|
||||||
let geometry = self.cache.draw(bounds.size(), |frame| {
|
let geometry = self.cache.draw(bounds.size(), |frame| {
|
||||||
|
let palette = theme.palette();
|
||||||
|
|
||||||
let center = frame.center();
|
let center = frame.center();
|
||||||
let radius = frame.width().min(frame.height()) / 5.0;
|
let radius = frame.width().min(frame.height()) / 5.0;
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ impl<Message> canvas::Program<Message> for Arc {
|
||||||
b.circle(end, 10.0);
|
b.circle(end, 10.0);
|
||||||
});
|
});
|
||||||
|
|
||||||
frame.fill(&circles, Color::WHITE);
|
frame.fill(&circles, palette.text);
|
||||||
|
|
||||||
let path = Path::new(|b| {
|
let path = Path::new(|b| {
|
||||||
b.move_to(start);
|
b.move_to(start);
|
||||||
|
|
@ -109,8 +109,6 @@ impl<Message> canvas::Program<Message> for Arc {
|
||||||
b.line_to(end);
|
b.line_to(end);
|
||||||
});
|
});
|
||||||
|
|
||||||
let palette = theme.palette();
|
|
||||||
|
|
||||||
frame.stroke(
|
frame.stroke(
|
||||||
&path,
|
&path,
|
||||||
Stroke {
|
Stroke {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue