diff --git a/emigui/src/context.rs b/emigui/src/context.rs index 10670344..07aec083 100644 --- a/emigui/src/context.rs +++ b/emigui/src/context.rs @@ -190,7 +190,7 @@ impl Context { let layer = Layer::Popup; // TODO: Layer::Error let text_style = TextStyle::Monospace; let font = &self.fonts[text_style]; - let (text, size) = font.layout_multiline(text, std::f32::INFINITY); + let (text, size) = font.layout_multiline(text, f32::INFINITY); let rect = align_rect(Rect::from_min_size(pos, size), align); self.add_paint_cmd( layer, @@ -216,7 +216,7 @@ impl Context { text_color: Option, ) -> Vec2 { let font = &self.fonts[text_style]; - let (text, size) = font.layout_multiline(text, std::f32::INFINITY); + let (text, size) = font.layout_multiline(text, f32::INFINITY); let rect = align_rect(Rect::from_min_size(pos, size), align); self.add_text(layer, rect.min(), text_style, text, text_color); size diff --git a/emigui/src/example_app.rs b/emigui/src/example_app.rs index 4dc30d4f..182ea5b2 100644 --- a/emigui/src/example_app.rs +++ b/emigui/src/example_app.rs @@ -193,9 +193,9 @@ impl Painting { self.current_line.clear(); } - region.add_custom_contents(vec2(std::f32::INFINITY, 200.0), |region| { + region.add_custom_contents(vec2(f32::INFINITY, 200.0), |region| { let interact = region.reserve_space(region.available_space(), Some(region.id)); - region.clip_rect = interact.rect; // Make sure we don't paint out of bounds + region.clip_rect = region.clip_rect.intersect(interact.rect); // Make sure we don't paint out of bounds if interact.active { if let Some(mouse_pos) = region.input().mouse_pos { diff --git a/emigui/src/layout.rs b/emigui/src/layout.rs index 14fef003..ab035bbe 100644 --- a/emigui/src/layout.rs +++ b/emigui/src/layout.rs @@ -101,7 +101,7 @@ pub fn show_popup(ctx: &Arc, window_pos: Pos2, add_contents: impl FnOnc let style = ctx.style(); let window_padding = style.window_padding; - let size = vec2(ctx.input.screen_size.x.min(350.0), std::f32::INFINITY); // TODO: popup/tooltip width + let size = vec2(ctx.input.screen_size.x.min(350.0), f32::INFINITY); // TODO: popup/tooltip width let inner_rect = Rect::from_min_size(window_pos + window_padding, size); let mut contents_region = Region::new(ctx.clone(), layer, Id::popup(), inner_rect); diff --git a/emigui/src/math.rs b/emigui/src/math.rs index 1454ded7..2d60a34c 100644 --- a/emigui/src/math.rs +++ b/emigui/src/math.rs @@ -291,7 +291,7 @@ pub struct Rect { impl Rect { /// Infinite rectangle that contains everything pub fn everything() -> Self { - let inf = std::f32::INFINITY; + let inf = f32::INFINITY; Self { min: pos2(-inf, -inf), max: pos2(inf, inf), @@ -299,7 +299,7 @@ impl Rect { } pub fn nothing() -> Self { - let inf = std::f32::INFINITY; + let inf = f32::INFINITY; Self { min: pos2(inf, inf), max: pos2(-inf, -inf), diff --git a/emigui/src/region.rs b/emigui/src/region.rs index a10d47cc..c07d2d84 100644 --- a/emigui/src/region.rs +++ b/emigui/src/region.rs @@ -407,7 +407,7 @@ impl Region { text_color: Option, ) -> Vec2 { let font = &self.fonts()[text_style]; - let (text, size) = font.layout_multiline(text, std::f32::INFINITY); + let (text, size) = font.layout_multiline(text, f32::INFINITY); let rect = align_rect(Rect::from_min_size(pos, size), align); self.add_text(rect.min(), text_style, text, text_color); size diff --git a/emigui/src/widgets.rs b/emigui/src/widgets.rs index 8270f1b9..79189e09 100644 --- a/emigui/src/widgets.rs +++ b/emigui/src/widgets.rs @@ -323,8 +323,8 @@ impl<'a> Slider<'a> { fn from_get_set(get_set_value: impl 'a + FnMut(Option) -> f32) -> Self { Slider { get_set_value: Box::new(get_set_value), - min: std::f32::NAN, - max: std::f32::NAN, + min: f32::NAN, + max: f32::NAN, text: None, precision: 3, text_on_top: None,