Include NaN in unchaged logic

This commit is contained in:
Cory Forsstrom 2023-04-12 12:47:24 -07:00
parent ee32af2606
commit 4125c034f5
No known key found for this signature in database
GPG key ID: 1DFE170A4415C9F5

View file

@ -920,7 +920,9 @@ fn notify_on_scroll<Message>(
// Don't publish redundant offsets to shell
if let Some(prev_offset) = state.last_notified {
let unchanged = |a: f32, b: f32| (a - b).abs() <= f32::EPSILON;
let unchanged = |a: f32, b: f32| {
(a - b).abs() <= f32::EPSILON || (a.is_nan() && b.is_nan())
};
if unchanged(prev_offset.x, new_offset.x)
&& unchanged(prev_offset.y, new_offset.y)