diff options
Diffstat (limited to 'native/src/layout/node.rs')
-rw-r--r-- | native/src/layout/node.rs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/native/src/layout/node.rs b/native/src/layout/node.rs index d7666f31..e9e6058e 100644 --- a/native/src/layout/node.rs +++ b/native/src/layout/node.rs @@ -1,4 +1,4 @@ -use crate::{Align, Point, Rectangle, Size}; +use crate::{Alignment, Point, Rectangle, Size}; /// The bounds of an element and its children. #[derive(Debug, Clone, Default)] @@ -44,28 +44,34 @@ impl Node { /// Aligns the [`Node`] in the given space. pub fn align( &mut self, - horizontal_alignment: Align, - vertical_alignment: Align, + horizontal_alignment: Alignment, + vertical_alignment: Alignment, space: Size, ) { match horizontal_alignment { - Align::Start => {} - Align::Center => { + Alignment::Start => {} + Alignment::Center => { self.bounds.x += (space.width - self.bounds.width) / 2.0; } - Align::End => { + Alignment::End => { self.bounds.x += space.width - self.bounds.width; } + Alignment::Fill => { + self.bounds.width = space.width; + } } match vertical_alignment { - Align::Start => {} - Align::Center => { + Alignment::Start => {} + Alignment::Center => { self.bounds.y += (space.height - self.bounds.height) / 2.0; } - Align::End => { + Alignment::End => { self.bounds.y += space.height - self.bounds.height; } + Alignment::Fill => { + self.bounds.height = space.height; + } } } |