summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Ernerfeldt <emil.ernerfeldt@gmail.com>2024-09-30 15:48:41 +0200
committerGitHub <noreply@github.com>2024-09-30 15:48:41 +0200
commitce744e6f7a22412cecf1cf2ea8678344bfb56489 (patch)
treef803b64fff6d3a24fc7df3b612f3a8aefb24e74d
parent15d3d43aa30317ec7c0611d4faae890166d7a22b (diff)
Do not round panel rectangles to pixel grid (#5196)
* Closes https://github.com/emilk/egui/issues/5173 * Part of https://github.com/emilk/egui/issues/5163 * Related to https://github.com/emilk/egui/issues/5164
-rw-r--r--crates/egui/src/containers/panel.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/crates/egui/src/containers/panel.rs b/crates/egui/src/containers/panel.rs
index f3b6c913..ee510457 100644
--- a/crates/egui/src/containers/panel.rs
+++ b/crates/egui/src/containers/panel.rs
@@ -329,9 +329,6 @@ impl SidePanel {
ui.ctx().set_cursor_icon(cursor_icon);
}
- // Keep this rect snapped so that panel content can be pixel-perfect
- let rect = ui.painter().round_rect_to_pixels(rect);
-
PanelState { rect }.store(ui.ctx(), id);
{
@@ -824,9 +821,6 @@ impl TopBottomPanel {
ui.ctx().set_cursor_icon(cursor_icon);
}
- // Keep this rect snapped so that panel content can be pixel-perfect
- let rect = ui.painter().round_rect_to_pixels(rect);
-
PanelState { rect }.store(ui.ctx(), id);
{
@@ -842,6 +836,8 @@ impl TopBottomPanel {
};
// TODO(emilk): draw line on top of all panels in this ui when https://github.com/emilk/egui/issues/1516 is done
let resize_y = side.opposite().side_y(rect);
+
+ // This makes it pixel-perfect for odd-sized strokes (width=1.0, width=3.0, etc)
let resize_y = ui.painter().round_to_pixel_center(resize_y);
// We want the line exactly on the last pixel but rust rounds away from zero so we bring it back a bit for