summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-05 03:43:54 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-11-05 03:43:54 +0100
commitb68ac3aa47369df503360efec21cd7ca4ffa719a (patch)
treedfb8dcddf91a15b81656f0fc9fd020a501bbf6bd /examples
parent81cfb863ab676204aee5f5d1ed0a2bd953833081 (diff)
parentda2717c74dbe3e1123ff41de345a409c1afc2f18 (diff)
downloadiced-b68ac3aa47369df503360efec21cd7ca4ffa719a.tar.gz
iced-b68ac3aa47369df503360efec21cd7ca4ffa719a.tar.bz2
iced-b68ac3aa47369df503360efec21cd7ca4ffa719a.zip
Merge branch 'master' into feature/performance-metrics
Diffstat (limited to 'examples')
-rw-r--r--examples/tour.rs31
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,