Increase accuracy of various Web APIs (#2946)
This commit is contained in:
parent
db8de03142
commit
c4d70d75c1
9 changed files with 73 additions and 38 deletions
|
|
@ -400,12 +400,17 @@ impl<T: 'static> Shared<T> {
|
|||
if !runner.0.suspended.get() {
|
||||
for (id, canvas) in &*runner.0.all_canvases.borrow() {
|
||||
if let Some(canvas) = canvas.upgrade() {
|
||||
if backend::is_intersecting(runner.window(), canvas.borrow().raw()) {
|
||||
let is_visible = backend::is_visible(runner.window());
|
||||
// only fire if:
|
||||
// - not visible and intersects
|
||||
// - not visible and we don't know if it intersects yet
|
||||
// - visible and intersects
|
||||
if let (false, Some(true) | None) | (true, Some(true)) =
|
||||
(is_visible, canvas.borrow().is_intersecting)
|
||||
{
|
||||
runner.send_event(Event::WindowEvent {
|
||||
window_id: *id,
|
||||
event: WindowEvent::Occluded(!backend::is_visible(
|
||||
runner.window(),
|
||||
)),
|
||||
event: WindowEvent::Occluded(!is_visible),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue