1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Improve egui_extras::Table layout (#4755)

Mostly a refactor, but some minor fixes to how it works.

Mostly preparing for a few bigger changes.
This commit is contained in:
Emil Ernerfeldt
2024-07-02 20:57:46 +02:00
committed by GitHub
parent f0e2bd8b00
commit 753412193c
7 changed files with 88 additions and 75 deletions

View File

@@ -191,12 +191,12 @@ impl<'l> StripLayout<'l> {
fn cell(
&mut self,
flags: StripLayoutFlags,
rect: Rect,
max_rect: Rect,
child_ui_id_source: egui::Id,
add_cell_contents: impl FnOnce(&mut Ui),
) -> Ui {
let mut child_ui = self.ui.child_ui_with_id_source(
rect,
max_rect,
self.cell_layout,
child_ui_id_source,
Some(egui::UiStackInfo::new(egui::UiKind::TableCell)),
@@ -205,7 +205,7 @@ impl<'l> StripLayout<'l> {
if flags.clip {
let margin = egui::Vec2::splat(self.ui.visuals().clip_rect_margin);
let margin = margin.min(0.5 * self.ui.spacing().item_spacing);
let clip_rect = rect.expand2(margin);
let clip_rect = max_rect.expand2(margin);
child_ui.set_clip_rect(clip_rect.intersect(child_ui.clip_rect()));
}