Include NaN in unchaged logic
This commit is contained in:
parent
ee32af2606
commit
4125c034f5
1 changed files with 3 additions and 1 deletions
|
|
@ -920,7 +920,9 @@ fn notify_on_scroll<Message>(
|
||||||
|
|
||||||
// Don't publish redundant offsets to shell
|
// Don't publish redundant offsets to shell
|
||||||
if let Some(prev_offset) = state.last_notified {
|
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)
|
if unchanged(prev_offset.x, new_offset.x)
|
||||||
&& unchanged(prev_offset.y, new_offset.y)
|
&& unchanged(prev_offset.y, new_offset.y)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue