diff --git a/src/widgets/toplevels/mod.rs b/src/widgets/toplevels/mod.rs index 08a19ca..356f681 100644 --- a/src/widgets/toplevels/mod.rs +++ b/src/widgets/toplevels/mod.rs @@ -15,11 +15,8 @@ use toplevel_layout::{LayoutToplevel, RowColToplevelLayout, ToplevelLayout}; pub fn toplevels(children: Vec>) -> Toplevels { Toplevels { - layout: RowColToplevelLayout { - // TODO configurable - spacing: 16, - axis: Axis::Horizontal, - }, + // TODO configurable + layout: RowColToplevelLayout::new(Axis::Horizontal, 16), children, _msg: PhantomData, } diff --git a/src/widgets/toplevels/toplevel_layout/row_col_toplevel_layout.rs b/src/widgets/toplevels/toplevel_layout/row_col_toplevel_layout.rs index d9e176f..6557ee2 100644 --- a/src/widgets/toplevels/toplevel_layout/row_col_toplevel_layout.rs +++ b/src/widgets/toplevels/toplevel_layout/row_col_toplevel_layout.rs @@ -11,6 +11,10 @@ pub(crate) struct RowColToplevelLayout { } impl RowColToplevelLayout { + pub fn new(axis: Axis, spacing: u32) -> Self { + Self { axis, spacing } + } + // Get total requested main axis length if widget could have all the space pub fn requested_main_total(&self, toplevels: &[LayoutToplevel<'_, AxisSize>]) -> f32 { let total_spacing = self.spacing as usize * (toplevels.len().saturating_sub(1)).max(0);