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:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user