diff options
author | 2019-11-03 05:19:51 +0100 | |
---|---|---|
committer | 2019-11-03 05:19:51 +0100 | |
commit | 075fcf1a52fd478ec1f9451278c582f34b95fdfe (patch) | |
tree | 1c1c52c51bacafbca18c25f7c9ad796109fba990 /examples/tour.rs | |
parent | f3baae92282566ccb6ff3689a08fcaa907430ef7 (diff) | |
parent | 0ea911ae36bbde8c288f7ae1ba8a0049b696d7c4 (diff) | |
download | iced-075fcf1a52fd478ec1f9451278c582f34b95fdfe.tar.gz iced-075fcf1a52fd478ec1f9451278c582f34b95fdfe.tar.bz2 iced-075fcf1a52fd478ec1f9451278c582f34b95fdfe.zip |
Merge branch 'master' into feature/text-input
Diffstat (limited to 'examples/tour.rs')
-rw-r--r-- | examples/tour.rs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/examples/tour.rs b/examples/tour.rs index c2b3e645..c5daa2c5 100644 --- a/examples/tour.rs +++ b/examples/tour.rs @@ -528,20 +528,7 @@ impl<'a> Step { ) -> Column<'a, StepMessage> { Self::container("Image") .push(Text::new("An image that tries to keep its aspect ratio.")) - .push( - // This should go away once we unify resource loading on native - // platforms - if cfg!(target_arch = "wasm32") { - Image::new("resources/ferris.png") - } else { - Image::new(format!( - "{}/examples/resources/ferris.png", - env!("CARGO_MANIFEST_DIR") - )) - } - .width(Length::Units(width)) - .align_self(Align::Center), - ) + .push(ferris(width)) .push(Slider::new( slider, 100.0..=500.0, @@ -573,6 +560,7 @@ impl<'a> Step { .horizontal_alignment(HorizontalAlignment::Center), ) .push(Column::new().height(Length::Units(4096))) + .push(ferris(300)) .push( Text::new("You made it!") .size(50) @@ -639,6 +627,21 @@ impl<'a> Step { } } +fn ferris(width: u16) -> Image { + // This should go away once we unify resource loading on native + // platforms + if cfg!(target_arch = "wasm32") { + Image::new("resources/ferris.png") + } else { + Image::new(format!( + "{}/examples/resources/ferris.png", + env!("CARGO_MANIFEST_DIR") + )) + } + .width(Length::Units(width)) + .align_self(Align::Center) +} + fn button<'a, Message>( state: &'a mut button::State, label: &str, |