window.addEventListener('resize', () => {
game.ui.root.style.fontSize = (game.ui.root.clientWidth / 50) + 'px';
});
+window.addEventListener('scroll', () => {
+ let bbox = game.ui.root.querySelector('canvas').getBoundingClientRect();
+ if(game.ui.currentPage != 'gameplay') {
+ return;
+ }
+ if(bbox.bottom < -100 || bbox.top - bbox.height > 100 || bbox.left + bbox.width < -100 || bbox.left - window.innerWidth > 100) {
+ game.ui.moveToPage('pause', true);
+ }
+});
window.addEventListener('blur', () => {
if(game.ui.currentPage == 'gameplay') {
game.ui.moveToPage('pause', true);