From 4125c034f5c512365c6ef73678dc0801db79b249 Mon Sep 17 00:00:00 2001 From: Cory Forsstrom Date: Wed, 12 Apr 2023 12:47:24 -0700 Subject: Include NaN in unchaged logic --- native/src/widget/scrollable.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'native/src/widget') diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index 23fa20f4..c0590b1e 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -920,7 +920,9 @@ fn notify_on_scroll( // 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) -- cgit