mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 06:10:06 -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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user