Deprecate ui.centered
It didn't do what it advertised to do, and there is no simple way of doing that right now.
This commit is contained in:
parent
c8771cd13e
commit
ec0b2d8e9a
2 changed files with 6 additions and 16 deletions
|
@ -229,22 +229,10 @@ impl Layout {
|
|||
}
|
||||
}
|
||||
|
||||
/// For when you want to add a single widget to a layout, and that widget
|
||||
/// should be centered horizontally and vertically.
|
||||
#[inline(always)]
|
||||
pub fn centered(main_dir: Direction) -> Self {
|
||||
Self {
|
||||
main_dir,
|
||||
main_wrap: false,
|
||||
main_align: Align::Center,
|
||||
main_justify: false,
|
||||
cross_align: Align::Center,
|
||||
cross_justify: false,
|
||||
}
|
||||
}
|
||||
|
||||
/// For when you want to add a single widget to a layout, and that widget
|
||||
/// should use up all available space.
|
||||
///
|
||||
/// Only one widget may be added to the inner `Ui`!
|
||||
#[inline(always)]
|
||||
pub fn centered_and_justified(main_dir: Direction) -> Self {
|
||||
Self {
|
||||
|
|
|
@ -2007,12 +2007,14 @@ impl Ui {
|
|||
InnerResponse::new(inner, self.interact(rect, child_ui.id, Sense::hover()))
|
||||
}
|
||||
|
||||
/// This will make the next added widget centered in the available space.
|
||||
#[deprecated = "Use ui.vertical_centered instead"]
|
||||
pub fn centered<R>(&mut self, add_contents: impl FnOnce(&mut Self) -> R) -> InnerResponse<R> {
|
||||
self.with_layout_dyn(Layout::centered(Direction::TopDown), Box::new(add_contents))
|
||||
self.vertical_centered(add_contents)
|
||||
}
|
||||
|
||||
/// This will make the next added widget centered and justified in the available space.
|
||||
///
|
||||
/// Only one widget may be added to the inner `Ui`!
|
||||
pub fn centered_and_justified<R>(
|
||||
&mut self,
|
||||
add_contents: impl FnOnce(&mut Self) -> R,
|
||||
|
|
Loading…
Reference in a new issue