Skip to content

Commit b7c6a5c

Browse files
authored
Fix table placement within containers (#43)
Fix layout and size reporting if placed within container with non-default layout and/or margins. * Closes #41
1 parent dfd09c7 commit b7c6a5c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

egui_table/src/split_scroll.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ impl SplitScroll {
7272
let mut rect = ui.cursor();
7373
rect.max = rect.min + fixed_size + scroll_outer_size;
7474
ui.shrink_clip_rect(rect);
75+
let rect = rect;
7576

7677
let bottom_right_rect = Rect::from_min_max(rect.min + fixed_size, rect.max);
7778

@@ -148,6 +149,7 @@ impl SplitScroll {
148149
}
149150

150151
delegate.finish(ui);
152+
ui.advance_cursor_after_rect(rect);
151153
});
152154
}
153155
}

egui_table/src/table.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use std::{
44
};
55

66
use egui::{
7-
Align, Context, Id, IdMap, NumExt as _, Rangef, Rect, Response, Ui, UiBuilder, Vec2, Vec2b,
8-
vec2,
7+
Align, Context, Id, IdMap, Layout, NumExt as _, Rangef, Rect, Response, Ui, UiBuilder, Vec2,
8+
Vec2b, vec2,
99
};
1010
use vec1::Vec1;
1111

@@ -418,7 +418,7 @@ impl Table {
418418
self.headers.iter().map(|h| h.height).sum(),
419419
);
420420

421-
let mut ui_builder = UiBuilder::new();
421+
let mut ui_builder = UiBuilder::new().layout(Layout::top_down(Align::Min));
422422
if do_full_sizing_pass {
423423
ui_builder = ui_builder.sizing_pass().invisible();
424424
ui.ctx().request_discard("Full egui_table sizing");

0 commit comments

Comments
 (0)