From ef0d610764ccd7394f8b946d39591585b972ed82 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Wed, 6 Mar 2024 17:00:18 +0100 Subject: [PATCH] add wrap flag --- hui-examples/examples/ui_test_wrapping.rs | 8 +++++--- hui/src/element/builtin/container.rs | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hui-examples/examples/ui_test_wrapping.rs b/hui-examples/examples/ui_test_wrapping.rs index b679590..2fa7443 100644 --- a/hui-examples/examples/ui_test_wrapping.rs +++ b/hui-examples/examples/ui_test_wrapping.rs @@ -1,10 +1,12 @@ use hui::{ - color, element::{ + color, size, + layout::UiDirection, + element::{ container::Container, fill_rect::FillRect, text::Text, UiElementExt - }, layout::{Alignment, UiDirection}, size + }, }; #[path = "../boilerplate.rs"] @@ -18,7 +20,7 @@ ui_main!(|ui, size, _| { .with_padding(5.) .with_gap(10.) .with_background(color::WHITE) - //.with_wrap(true) + .with_wrap(true) .with_children(|ui| { Text::default() .with_color(color::BLACK) diff --git a/hui/src/element/builtin/container.rs b/hui/src/element/builtin/container.rs index 5c18382..9da731e 100644 --- a/hui/src/element/builtin/container.rs +++ b/hui/src/element/builtin/container.rs @@ -51,6 +51,10 @@ pub struct Container { #[setters(into)] pub corner_radius: Corners, + /// Should the elements wrap?\ + /// TODO: NOT IMPLEMENTED YET, implement this + pub wrap: bool, + /// List of children elements #[setters(skip)] pub children: ElementList, @@ -73,6 +77,7 @@ impl Default for Container { align: Alignment2d::default(), background: Default::default(), children: ElementList(Vec::new()), + wrap: false, corner_radius: Corners::all(0.), } }