summaryrefslogtreecommitdiffstats
path: root/examples/tour
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-05 19:02:16 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-05 19:02:16 +0200
commitae56edc8ccd3462766071cc00c12e92feccf1274 (patch)
tree50bc77c01a78d1deb6a817495a5a174a59646b1a /examples/tour
parent957beeebf911e0c137fc60e02c2b65663f0bbfa6 (diff)
downloadiced-ae56edc8ccd3462766071cc00c12e92feccf1274.tar.gz
iced-ae56edc8ccd3462766071cc00c12e92feccf1274.tar.bz2
iced-ae56edc8ccd3462766071cc00c12e92feccf1274.zip
Center `tour` example
Diffstat (limited to 'examples/tour')
-rw-r--r--examples/tour/src/main.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs
index 2b4a0e80..0b88ccd5 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -1,6 +1,7 @@
use iced::{
button, slider, text::HorizontalAlignment, Align, Button, Checkbox, Color,
- Column, Element, Image, Length, Radio, Row, Slider, Text, UserInterface,
+ Column, Element, Image, Justify, Length, Radio, Row, Slider, Text,
+ UserInterface,
};
pub fn main() {
@@ -78,11 +79,19 @@ impl UserInterface for Tour {
.push(controls)
.into();
- if self.debug {
+ let element = if self.debug {
element.explain(Color::BLACK)
} else {
element
- }
+ };
+
+ Column::new()
+ .width(Length::Fill)
+ .height(Length::Fill)
+ .align_items(Align::Center)
+ .justify_content(Justify::Center)
+ .push(element)
+ .into()
}
}