1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40: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:
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

@@ -519,7 +519,9 @@ impl Fonts {
self.lock().fonts.has_glyphs(font_id, s)
}
/// Height of one row of text in points
/// Height of one row of text in points.
///
/// Returns a value rounded to [`emath::GUI_ROUNDING`].
#[inline]
pub fn row_height(&self, font_id: &FontId) -> f32 {
self.lock().fonts.row_height(font_id)
@@ -706,6 +708,8 @@ impl FontsImpl {
}
/// Height of one row of text in points.
///
/// Returns a value rounded to [`emath::GUI_ROUNDING`].
fn row_height(&mut self, font_id: &FontId) -> f32 {
self.font(font_id).row_height()
}