Skip to content

Commit

Permalink
ios: attempt to fix rendering glitch when waking up after sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-emmanuel committed Oct 22, 2022
1 parent 7824912 commit 7ffe125
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- bug fixes
- canvas: `onTouch` not triggered on iOS when when `event.force`, `event.altitudeAngle` or `event.azimuthAngle` changes
- switch: interaction issue when value labels contain icons
- ios: attempt to fix rendering glitch when waking up after sleep

## 1.18.1

Expand Down
16 changes: 16 additions & 0 deletions src/client/ui/ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ if (iOS && !iOS13) {

}

if (iOS) {
// when waking from sleep, iOS may have trouble rendering the session properly
// this attempts to force a full redraw by shortly resizing the main container
document.onvisibilitychange = ()=>{
if (document.visibilityState === 'visible') {
var main = DOM.get('osc-panel-container#main')[0]
main.style.marginBottom = '1px'
main.style.marginRight = '1px'
setTimeout(()=>{
main.style.marginBottom = ''
main.style.marginRight = ''
})
}
}
}

if (iOS13) document.body.classList.add('iOS13')

module.exports = iOS

0 comments on commit 7ffe125

Please sign in to comment.