diff options
author | 2022-05-26 23:12:11 +0200 | |
---|---|---|
committer | 2022-05-26 23:12:11 +0200 | |
commit | d5bc610d0139fb331a59fc904a932d156f637391 (patch) | |
tree | 811224c202afe989777abe0f7683405ed1ac5242 /examples/game_of_life | |
parent | cf0230072c01ea9523f4d98a3656f5c975b3f347 (diff) | |
download | iced-d5bc610d0139fb331a59fc904a932d156f637391.tar.gz iced-d5bc610d0139fb331a59fc904a932d156f637391.tar.bz2 iced-d5bc610d0139fb331a59fc904a932d156f637391.zip |
Fix examples and doc-tests
Diffstat (limited to 'examples/game_of_life')
-rw-r--r-- | examples/game_of_life/src/main.rs | 15 | ||||
-rw-r--r-- | examples/game_of_life/src/style.rs | 54 |
2 files changed, 7 insertions, 62 deletions
diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs index 3e9c24a0..080cbac3 100644 --- a/examples/game_of_life/src/main.rs +++ b/examples/game_of_life/src/main.rs @@ -850,15 +850,12 @@ impl Controls { .width(Length::Fill) .align_items(Alignment::Center) .spacing(10) - .push( - Slider::new( - &mut self.speed_slider, - 1.0..=1000.0, - speed as f32, - Message::SpeedChanged, - ) - .style(style::Slider), - ) + .push(Slider::new( + &mut self.speed_slider, + 1.0..=1000.0, + speed as f32, + Message::SpeedChanged, + )) .push(Text::new(format!("x{}", speed)).size(16)); Row::new() diff --git a/examples/game_of_life/src/style.rs b/examples/game_of_life/src/style.rs index 688635e0..ea215dd8 100644 --- a/examples/game_of_life/src/style.rs +++ b/examples/game_of_life/src/style.rs @@ -1,16 +1,4 @@ -use iced::{container, pick_list, slider, Background, Color}; - -const ACTIVE: Color = Color::from_rgb( - 0x72 as f32 / 255.0, - 0x89 as f32 / 255.0, - 0xDA as f32 / 255.0, -); - -const HOVERED: Color = Color::from_rgb( - 0x67 as f32 / 255.0, - 0x7B as f32 / 255.0, - 0xC4 as f32 / 255.0, -); +use iced::{container, pick_list, Background, Color}; const BACKGROUND: Color = Color::from_rgb( 0x2F as f32 / 255.0, @@ -32,46 +20,6 @@ impl container::StyleSheet for Container { } } -pub struct Slider; - -impl slider::StyleSheet for Slider { - fn active(&self) -> slider::Style { - slider::Style { - rail_colors: (ACTIVE, Color { a: 0.1, ..ACTIVE }), - handle: slider::Handle { - shape: slider::HandleShape::Circle { radius: 9.0 }, - color: ACTIVE, - border_width: 0.0, - border_color: Color::TRANSPARENT, - }, - } - } - - fn hovered(&self) -> slider::Style { - let active = self.active(); - - slider::Style { - handle: slider::Handle { - color: HOVERED, - ..active.handle - }, - ..active - } - } - - fn dragging(&self) -> slider::Style { - let active = self.active(); - - slider::Style { - handle: slider::Handle { - color: Color::from_rgb(0.85, 0.85, 0.85), - ..active.handle - }, - ..active - } - } -} - pub struct PickList; impl pick_list::StyleSheet for PickList { |