diff options
author | 2021-09-20 15:09:55 +0700 | |
---|---|---|
committer | 2021-09-20 15:14:08 +0700 | |
commit | a0ad3996225601aaa1ebe051cba115374b55c80e (patch) | |
tree | 8420a91cd319a63b1ed257a6334453a1a673bdfb /native/src/layout/node.rs | |
parent | 5fae6e59ffbc5913761df638dc7f0c35b7f43bc9 (diff) | |
download | iced-a0ad3996225601aaa1ebe051cba115374b55c80e.tar.gz iced-a0ad3996225601aaa1ebe051cba115374b55c80e.tar.bz2 iced-a0ad3996225601aaa1ebe051cba115374b55c80e.zip |
Refactor alignment types into an `alignment` module
Diffstat (limited to '')
-rw-r--r-- | native/src/layout/node.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/native/src/layout/node.rs b/native/src/layout/node.rs index 2239a654..e9e6058e 100644 --- a/native/src/layout/node.rs +++ b/native/src/layout/node.rs @@ -1,4 +1,4 @@ -use crate::{CrossAlign, Point, Rectangle, Size}; +use crate::{Alignment, Point, Rectangle, Size}; /// The bounds of an element and its children. #[derive(Debug, Clone, Default)] @@ -44,32 +44,32 @@ impl Node { /// Aligns the [`Node`] in the given space. pub fn align( &mut self, - horizontal_alignment: CrossAlign, - vertical_alignment: CrossAlign, + horizontal_alignment: Alignment, + vertical_alignment: Alignment, space: Size, ) { match horizontal_alignment { - CrossAlign::Start => {} - CrossAlign::Center => { + Alignment::Start => {} + Alignment::Center => { self.bounds.x += (space.width - self.bounds.width) / 2.0; } - CrossAlign::End => { + Alignment::End => { self.bounds.x += space.width - self.bounds.width; } - CrossAlign::Fill => { + Alignment::Fill => { self.bounds.width = space.width; } } match vertical_alignment { - CrossAlign::Start => {} - CrossAlign::Center => { + Alignment::Start => {} + Alignment::Center => { self.bounds.y += (space.height - self.bounds.height) / 2.0; } - CrossAlign::End => { + Alignment::End => { self.bounds.y += space.height - self.bounds.height; } - CrossAlign::Fill => { + Alignment::Fill => { self.bounds.height = space.height; } } |