diff options
author | 2021-09-20 14:33:02 +0700 | |
---|---|---|
committer | 2021-09-20 15:12:43 +0700 | |
commit | 5fae6e59ffbc5913761df638dc7f0c35b7f43bc9 (patch) | |
tree | 02cbacf17780d1df9e37b38a33c0f882ab9312d7 /native/src/layout/node.rs | |
parent | 95e4791a1e4611f0db703ac2911f56b391469b5f (diff) | |
download | iced-5fae6e59ffbc5913761df638dc7f0c35b7f43bc9.tar.gz iced-5fae6e59ffbc5913761df638dc7f0c35b7f43bc9.tar.bz2 iced-5fae6e59ffbc5913761df638dc7f0c35b7f43bc9.zip |
Introduce and use `CrossAlign` enum for `Column` and `Row`
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 bee5e64e..2239a654 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::{CrossAlign, 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: Align, - vertical_alignment: Align, + horizontal_alignment: CrossAlign, + vertical_alignment: CrossAlign, space: Size, ) { match horizontal_alignment { - Align::Start => {} - Align::Center => { + CrossAlign::Start => {} + CrossAlign::Center => { self.bounds.x += (space.width - self.bounds.width) / 2.0; } - Align::End => { + CrossAlign::End => { self.bounds.x += space.width - self.bounds.width; } - Align::Fill => { + CrossAlign::Fill => { self.bounds.width = space.width; } } match vertical_alignment { - Align::Start => {} - Align::Center => { + CrossAlign::Start => {} + CrossAlign::Center => { self.bounds.y += (space.height - self.bounds.height) / 2.0; } - Align::End => { + CrossAlign::End => { self.bounds.y += space.height - self.bounds.height; } - Align::Fill => { + CrossAlign::Fill => { self.bounds.height = space.height; } } |