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

Round widget coordinates to even multiple of 1/32 (#5517)

* Closes https://github.com/emilk/egui/pull/5197
* Closes https://github.com/emilk/egui/issues/5163

This should help prevent rounding errors in layout code.

@lucasmerlin you may wanna test this with `egui_flex`
This commit is contained in:
Emil Ernerfeldt
2024-12-26 20:54:24 +01:00
committed by GitHub
parent f30f5e9578
commit dfcc679d5a
48 changed files with 377 additions and 136 deletions

View File

@@ -1,4 +1,4 @@
use egui::{Id, Pos2, Rect, Response, Sense, Ui, UiBuilder};
use egui::{emath::GuiRounding, Id, Pos2, Rect, Response, Sense, Ui, UiBuilder};
#[derive(Clone, Copy)]
pub(crate) enum CellSize {
@@ -123,7 +123,7 @@ impl<'l> StripLayout<'l> {
// Make sure we don't have a gap in the stripe/frame/selection background:
let item_spacing = self.ui.spacing().item_spacing;
let gapless_rect = max_rect.expand2(0.5 * item_spacing);
let gapless_rect = max_rect.expand2(0.5 * item_spacing).round_ui();
if flags.striped {
self.ui.painter().rect_filled(