diff options
author | 2023-04-12 12:47:24 -0700 | |
---|---|---|
committer | 2023-04-12 14:08:18 -0700 | |
commit | 4125c034f5c512365c6ef73678dc0801db79b249 (patch) | |
tree | 3a4d00f1d4bac3b669a6cb253aeaf124172848db /native | |
parent | ee32af2606e7c24cbe9e1c221af0ed1a2c44be50 (diff) | |
download | iced-4125c034f5c512365c6ef73678dc0801db79b249.tar.gz iced-4125c034f5c512365c6ef73678dc0801db79b249.tar.bz2 iced-4125c034f5c512365c6ef73678dc0801db79b249.zip |
Include NaN in unchaged logic
Diffstat (limited to '')
-rw-r--r-- | native/src/widget/scrollable.rs | 4 |
1 files changed, 3 insertions, 1 deletions
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<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) |