mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 23:23:14 -04:00
Increase accuracy of various Web APIs (#2946)
This commit is contained in:
committed by
Kirill Chibisov
parent
fab0f62c5a
commit
1d80005b91
@@ -12,19 +12,9 @@ impl IntersectionObserverHandle {
|
||||
where
|
||||
F: 'static + FnMut(bool),
|
||||
{
|
||||
let mut skip = true;
|
||||
let closure = Closure::new(move |entries: Array| {
|
||||
let entry: IntersectionObserverEntry = entries.get(0).unchecked_into();
|
||||
|
||||
let is_intersecting = entry.is_intersecting();
|
||||
|
||||
// skip first intersection
|
||||
if skip && is_intersecting {
|
||||
skip = false;
|
||||
return;
|
||||
}
|
||||
|
||||
callback(is_intersecting);
|
||||
callback(entry.is_intersecting());
|
||||
});
|
||||
let observer = IntersectionObserver::new(closure.as_ref().unchecked_ref())
|
||||
// we don't provide any `options`
|
||||
|
||||
Reference in New Issue
Block a user