Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not round panel rectangles to pixel grid (emilk#5196)
Browse files Browse the repository at this point in the history
* Closes emilk#5173
* Part of emilk#5163
* Related to emilk#5164
emilk authored and hacknus committed Oct 30, 2024
1 parent 9a69c2b commit dac81d8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions crates/egui/src/containers/panel.rs
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit dac81d8

Please sign in to comment.