summaryrefslogtreecommitdiffstats
path: root/examples/tour.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-23 01:21:23 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-23 01:21:23 +0200
commit38b6c84e7761c049b17d178deb9c866386a53946 (patch)
tree64921276031527078a447add30e188f6e4cc217a /examples/tour.rs
parentf8a232c8af4c50557fbf0c2e0b2ba46fb63f6adc (diff)
downloadiced-38b6c84e7761c049b17d178deb9c866386a53946.tar.gz
iced-38b6c84e7761c049b17d178deb9c866386a53946.tar.bz2
iced-38b6c84e7761c049b17d178deb9c866386a53946.zip
Implement basic image rendering in `iced_wgpu`
Diffstat (limited to 'examples/tour.rs')
-rw-r--r--examples/tour.rs17
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,