1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

Layout::left_to_right/right_to_left now takes the valign as argument

Previous default was `Align::Center`.

Closes https://github.com/emilk/egui/issues/1040
Closes https://github.com/emilk/egui/issues/1836
Closes https://github.com/emilk/egui/pull/1837
This commit is contained in:
Emil Ernerfeldt
2022-07-22 11:02:26 +02:00
parent 9f1f0a9038
commit 41f31116ce
8 changed files with 29 additions and 29 deletions

View File

@@ -221,7 +221,7 @@ impl DemoWindows {
}
});
ui.with_layout(egui::Layout::right_to_left(), |ui| {
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
use egui::special_emojis::{GITHUB, TWITTER};
ui.hyperlink_to(
egui::RichText::new(TWITTER).size(font_size),

View File

@@ -25,7 +25,7 @@ pub fn password_ui(ui: &mut egui::Ui, password: &mut String) -> egui::Response {
// Process ui, change a local copy of the state
// We want TextEdit to fill entire space, and have button after that, so in that case we can
// change direction to right_to_left.
let result = ui.with_layout(egui::Layout::right_to_left(), |ui| {
let result = ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
// Toggle the `show_plaintext` bool with a button:
let response = ui
.add(egui::SelectableLabel::new(show_plaintext, "👁"))

View File

@@ -96,7 +96,7 @@ impl TableDemo {
TableBuilder::new(ui)
.striped(true)
.cell_layout(egui::Layout::left_to_right().with_cross_align(egui::Align::Center))
.cell_layout(egui::Layout::left_to_right(egui::Align::Center))
.column(Size::initial(60.0).at_least(40.0))
.column(Size::initial(60.0).at_least(40.0))
.column(Size::remainder().at_least(60.0))

View File

@@ -12,9 +12,7 @@ pub fn easy_mark_it<'em>(ui: &mut Ui, items: impl Iterator<Item = easy_mark::Ite
ui.spacing().interact_size.y, // Assume there will be
);
let layout = Layout::left_to_right()
.with_main_wrap(true)
.with_cross_align(Align::BOTTOM);
let layout = Layout::left_to_right(Align::BOTTOM).with_main_wrap(true);
ui.allocate_ui_with_layout(initial_size, layout, |ui| {
ui.spacing_mut().item_spacing.x = 0.0;