From ae56edc8ccd3462766071cc00c12e92feccf1274 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 5 Oct 2019 19:02:16 +0200 Subject: Center `tour` example --- examples/tour/src/main.rs | 15 ++++++++++++--- 1 file 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() } } -- cgit