diff options
author | 2019-10-23 01:21:23 +0200 | |
---|---|---|
committer | 2019-10-23 01:21:23 +0200 | |
commit | 38b6c84e7761c049b17d178deb9c866386a53946 (patch) | |
tree | 64921276031527078a447add30e188f6e4cc217a /examples | |
parent | f8a232c8af4c50557fbf0c2e0b2ba46fb63f6adc (diff) | |
download | iced-38b6c84e7761c049b17d178deb9c866386a53946.tar.gz iced-38b6c84e7761c049b17d178deb9c866386a53946.tar.bz2 iced-38b6c84e7761c049b17d178deb9c866386a53946.zip |
Implement basic image rendering in `iced_wgpu`
Diffstat (limited to 'examples')
-rw-r--r-- | examples/tour.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/examples/tour.rs b/examples/tour.rs index f77dc241..06be4766 100644 --- a/examples/tour.rs +++ b/examples/tour.rs @@ -74,7 +74,7 @@ impl Application for Tour { } let element: Element<_> = Column::new() - .max_width(Length::Units(500)) + .max_width(Length::Units(540)) .spacing(20) .padding(20) .push(steps.view(self.debug).map(Message::StepMessage)) @@ -503,9 +503,18 @@ impl<'a> Step { Self::container("Image") .push(Text::new("An image that tries to keep its aspect ratio.")) .push( - Image::new("resources/ferris.png") - .width(Length::Units(width)) - .align_self(Align::Center), + // 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(Slider::new( slider, |