You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use eframe::egui;fnmain(){let native_options = eframe::NativeOptions::default();
eframe::run_native("Commonmark bug",
native_options,Box::new(|_cc| Box::new(App::default())),).expect("failed to run app");}#[derive(Default)]structApp{content:String,}impl eframe::AppforApp{fnupdate(&mutself,ctx:&egui::Context,_frame:&mut eframe::Frame){
egui::CentralPanel::default().show(ctx, |ui| {
egui::Grid::new("my_grid").num_columns(2).striped(true).show(ui, |ui| {
ui.label("row 1, col 1");
ui.label("row 1, col 2");
ui.end_row();
ui.label("row 2, col 1");let layout =
egui::Layout::left_to_right(egui::Align::BOTTOM).with_main_wrap(true);
ui.allocate_ui_with_layout(egui::vec2(200.0,0.0), layout, |ui| {
ui.label(&self.content);});});});self.content += "a";
ctx.request_repaint();}
with_main_wrap is guilty. My naive guess is that the layout grows downwards, but the grid tries to center it, so it allocates space on both sides which is what causes the growth. I have tried different Align options but it does not appear to change anything.
I don't know whether this is a case of using egui wrong or if it's a bug in Grid.
gridbug.mp4
Minimal reproducible example with
eframe
:The text was updated successfully, but these errors were encountered: