Skip to content

Commit

Permalink
v4
Browse files Browse the repository at this point in the history
  • Loading branch information
aliraza556 committed Aug 11, 2024
1 parent 02a7de5 commit cf00f05
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions src/ui/fullscreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,28 @@ export class Fullscreen {
document.addEventListener('keydown', (event) => {
if (event.key === 'F11') {
event.preventDefault();
this.enterFullscreen();
this.toggle();
} else if (event.shiftKey && event.key === 'F') {
this.exitFullscreen();
this.toggle();
}
});
}

enterFullscreen() {
this.button.classList.add('fullscreenMode');
this.button
.querySelectorAll('.fullscreen__title')
.forEach((el) => (el.textContent = 'Contract'));
document.getElementById('AncientBeast').requestFullscreen();
}

exitFullscreen() {
toggle() {
if (isAppInNativeFullscreenMode()) {
this.button.classList.remove('fullscreenMode');
this.button
.querySelectorAll('.fullscreen__title')
.forEach((el) => (el.textContent = 'FullScreen'));
document.exitFullscreen();
} else {
} else if (!isAppInNativeFullscreenMode() && window.innerHeight === screen.height) {
alert('Use F11 to exit fullscreen');
}
}

toggle() {
if (isAppInNativeFullscreenMode()) {
this.exitFullscreen();
} else {
this.enterFullscreen();
this.button.classList.add('fullscreenMode');
this.button
.querySelectorAll('.fullscreen__title')
.forEach((el) => (el.textContent = 'Contract'));
document.getElementById('AncientBeast').requestFullscreen();
}
}
}
Expand Down

0 comments on commit cf00f05

Please sign in to comment.