diff options
author | 2024-07-12 18:12:34 +0200 | |
---|---|---|
committer | 2024-07-12 18:12:34 +0200 | |
commit | 76737351ea9e116291112b7d576d9ed4f6bb5c2a (patch) | |
tree | a3b514583ab6f8981fb7656adb9d4d10ce9c466a /core/src | |
parent | f9dd5cbb099bbe44a57b6369be54a442363b7a8d (diff) | |
download | iced-76737351ea9e116291112b7d576d9ed4f6bb5c2a.tar.gz iced-76737351ea9e116291112b7d576d9ed4f6bb5c2a.tar.bz2 iced-76737351ea9e116291112b7d576d9ed4f6bb5c2a.zip |
Re-export variants of `Length` and `alignment` types
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/alignment.rs | 25 | ||||
-rw-r--r-- | core/src/widget/text.rs | 33 |
2 files changed, 2 insertions, 56 deletions
diff --git a/core/src/alignment.rs b/core/src/alignment.rs index cacf7ce3..8f01ef71 100644 --- a/core/src/alignment.rs +++ b/core/src/alignment.rs @@ -1,30 +1,5 @@ //! Align and position widgets. -/// Returns a value representing center alignment. -pub const fn center() -> Alignment { - Alignment::Center -} - -/// Returns a value representing left alignment. -pub const fn left() -> Horizontal { - Horizontal::Left -} - -/// Returns a value representing right alignment. -pub const fn right() -> Horizontal { - Horizontal::Right -} - -/// Returns a value representing top alignment. -pub const fn top() -> Vertical { - Vertical::Top -} - -/// Returns a value representing bottom alignment. -pub const fn bottom() -> Vertical { - Vertical::Bottom -} - /// Alignment on the axis of a container. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Alignment { diff --git a/core/src/widget/text.rs b/core/src/widget/text.rs index 6ae95c8b..990c5567 100644 --- a/core/src/widget/text.rs +++ b/core/src/widget/text.rs @@ -88,37 +88,8 @@ where /// Centers the [`Text`], both horizontally and vertically. pub fn center(self) -> Self { - self.center_x().center_y() - } - - /// Centers the [`Text`] horizontally. - pub fn center_x(self) -> Self { - self.align_x(alignment::center()) - } - - /// Aligns the [`Text`] to the left, the default. - pub fn align_left(self) -> Self { - self.align_x(alignment::left()) - } - - /// Aligns the [`Text`] to the right. - pub fn align_right(self) -> Self { - self.align_x(alignment::right()) - } - - /// Centers the [`Text`] vertically. - pub fn center_y(self) -> Self { - self.align_y(alignment::center()) - } - - /// Aligns the [`Text`] to the top, the default. - pub fn align_top(self) -> Self { - self.align_y(alignment::top()) - } - - /// Aligns the [`Text`] to the bottom. - pub fn align_bottom(self) -> Self { - self.align_y(alignment::bottom()) + self.align_x(alignment::Horizontal::Center) + .align_y(alignment::Vertical::Center) } /// Sets the [`alignment::Horizontal`] of the [`Text`]. |