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:
@@ -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()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user