add wrap flag

This commit is contained in:
griffi-gh 2024-03-06 17:00:18 +01:00
parent fff37d7345
commit 59271bd76d
2 changed files with 10 additions and 3 deletions

View file

@ -1,10 +1,12 @@
use hui::{ use hui::{
color, element::{ color, size,
layout::UiDirection,
element::{
container::Container, container::Container,
fill_rect::FillRect, fill_rect::FillRect,
text::Text, text::Text,
UiElementExt UiElementExt
}, layout::{Alignment, UiDirection}, size },
}; };
#[path = "../boilerplate.rs"] #[path = "../boilerplate.rs"]
@ -18,7 +20,7 @@ ui_main!(|ui, size, _| {
.with_padding(5.) .with_padding(5.)
.with_gap(10.) .with_gap(10.)
.with_background(color::WHITE) .with_background(color::WHITE)
//.with_wrap(true) .with_wrap(true)
.with_children(|ui| { .with_children(|ui| {
Text::default() Text::default()
.with_color(color::BLACK) .with_color(color::BLACK)

View file

@ -51,6 +51,10 @@ pub struct Container {
#[setters(into)] #[setters(into)]
pub corner_radius: Corners<f32>, pub corner_radius: Corners<f32>,
/// Should the elements wrap?\
/// TODO: NOT IMPLEMENTED YET, implement this
pub wrap: bool,
/// List of children elements /// List of children elements
#[setters(skip)] #[setters(skip)]
pub children: ElementList, pub children: ElementList,
@ -73,6 +77,7 @@ impl Default for Container {
align: Alignment2d::default(), align: Alignment2d::default(),
background: Default::default(), background: Default::default(),
children: ElementList(Vec::new()), children: ElementList(Vec::new()),
wrap: false,
corner_radius: Corners::all(0.), corner_radius: Corners::all(0.),
} }
} }