Skip to content

Commit

Permalink
feat: end full screen
Browse files Browse the repository at this point in the history
  • Loading branch information
rei1024 committed Oct 3, 2024
1 parent af2ae4f commit 680e82a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,17 @@ colorInput.addEventListener("input", () => {
});

const fullScreen = document.querySelector("#full-screen") as HTMLElement;
if (document.body.requestFullscreen) {
if (document.fullscreenEnabled) {
fullScreen.addEventListener("click", () => {
document.body.requestFullscreen();
settingsDialog.close();
if (document.fullscreenElement) {
document.exitFullscreen();
settingsDialog.close();
fullScreen.textContent = "Full Screen";
} else {
document.body.requestFullscreen();
settingsDialog.close();
fullScreen.textContent = "End Full Screen";
}
});
} else {
fullScreen.remove();
Expand Down

0 comments on commit 680e82a

Please sign in to comment.