add wrap flag

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

View file

@ -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)

View file

@ -51,6 +51,10 @@ pub struct Container {
#[setters(into)]
pub corner_radius: Corners<f32>,
/// 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.),
}
}