1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-03 15:20:05 -04:00
Files
egui/crates/emath
Emil Ernerfeldt 1a9d2af9ef Fix panic in hit-test when a widget rect contains a NaN (#8479)
* Closes <https://github.com/emilk/egui/issues/7870>
* [x] I have followed the instructions in the PR template

`WidgetRect` derives `PartialEq`, so a rect with a NaN coordinate is not
equal even to itself, and `close.iter().position(|w| *w ==
hit_click).unwrap()` panicked. We now look the hit up by id.

NaN rects got that far because `Rect::intersect` scrubs NaNs
(`f32::max(NAN, x) == x`), so `interact_rect` can be finite while `rect`
is not, sneaking past the existing NaN guard. Hit-testing now discards
those widgets too.

Finally, `Pos2` claims `Eq` while NaN breaks reflexivity, so `PartialEq`
is now hand-written and panics on NaN in debug builds.
2026-09-03 13:16:14 +00:00
..
2023-02-12 18:08:13 +01:00

emath - egui math library

Latest version Documentation unsafe forbidden MIT Apache

A bare-bones 2D math library with types and functions useful for GUI building.

Made for egui.