From f1cde5aab495824da6cf8e9d3c4b87a8d007a6f1 Mon Sep 17 00:00:00 2001 From: Roman Popov Date: Wed, 4 Feb 2026 08:52:39 -0800 Subject: [PATCH] Fix `CentralPanel::show_inside_dyn` to round `panel_rect` (#7868) While using CentralPanel::show_inside_dyn inside egui_tiles I've noticed that sometimes it renders "Unaligned" message with certain tile positions. Match SidePanel behavior by calling round_ui() on the panel rect. image --------- Co-authored-by: Emil Ernerfeldt --- crates/egui/src/containers/panel.rs | 2 +- crates/egui/src/context.rs | 2 +- crates/egui/src/placer.rs | 2 ++ crates/egui_demo_lib/tests/snapshots/demos/Misc Demos.png | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/egui/src/containers/panel.rs b/crates/egui/src/containers/panel.rs index 6281e6b41..f2a4c3b67 100644 --- a/crates/egui/src/containers/panel.rs +++ b/crates/egui/src/containers/panel.rs @@ -1066,7 +1066,7 @@ impl CentralPanel { id, UiBuilder::new() .layer_id(LayerId::background()) - .max_rect(ctx.available_rect().round_ui()), + .max_rect(ctx.available_rect()), ); panel_ui.set_clip_rect(ctx.content_rect()); diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index e28048edf..2665d5edd 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -798,7 +798,7 @@ impl Context { Id::new((ctx.viewport_id(), "__top_ui")), UiBuilder::new() .layer_id(LayerId::background()) - .max_rect(ctx.available_rect().round_ui()), + .max_rect(ctx.available_rect()), ); { diff --git a/crates/egui/src/placer.rs b/crates/egui/src/placer.rs index b5f68f72d..8c54204b9 100644 --- a/crates/egui/src/placer.rs +++ b/crates/egui/src/placer.rs @@ -1,4 +1,5 @@ use crate::{Layout, Painter, Pos2, Rect, Region, Vec2, grid, vec2}; +use emath::GuiRounding as _; #[cfg(debug_assertions)] use crate::{Align2, Color32, Stroke}; @@ -92,6 +93,7 @@ impl Placer { } else { self.layout.available_rect_before_wrap(&self.region) } + .round_ui() } /// Amount of space available for a widget. diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Misc Demos.png b/crates/egui_demo_lib/tests/snapshots/demos/Misc Demos.png index a12313e97..95c172d26 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Misc Demos.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Misc Demos.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:604f716e687fc26abba92769fe2dae75d850b18598d2e8a9524451ab0f760251 -size 65403 +oid sha256:56b44d26946770c0878e11e3197633697ad339a7e8fcffe7279a6b4c45cd3582 +size 65384