Improve alginment of text with e.g. buttons
@@ -230,18 +230,22 @@ impl Layout {
|| self.main_dir.is_vertical() && self.cross_align == Align::Max
}
- pub fn horizontal_align(self) -> Align {
+ fn horizontal_align(self) -> Align {
match self.main_dir {
- Direction::LeftToRight => Align::left(),
- Direction::RightToLeft => Align::right(),
+ // Direction::LeftToRight => Align::left(),
+ // Direction::RightToLeft => Align::right(),
+ Direction::LeftToRight | Direction::RightToLeft => Align::Center, // looks better to e.g. center text within a button
+
Direction::TopDown | Direction::BottomUp => self.cross_align,
}
}
- pub fn vertical_align(self) -> Align {
+ fn vertical_align(self) -> Align {
match self.main_dir {
- Direction::TopDown => Align::top(),
- Direction::BottomUp => Align::bottom(),
+ // Direction::TopDown => Align::top(),
+ // Direction::BottomUp => Align::bottom(),
+ Direction::TopDown | Direction::BottomUp => Align::Center, // looks better to e.g. center text within a button
+
Direction::LeftToRight | Direction::RightToLeft => self.cross_align,
}
}
