cinera_player_post.js: Fix fullscreen handling

It is possible to bring our player out of fullscreen mode without using
the provided views menu or keyboard shortcut, e.g. by pressing Escape.
Doing so leaves our state in the SUPERTHEATRE view, which omits
SUPERtheatre mode itself from the views menu. This commit fixes this by
switching our state to the THEATRE view.

Thanks to Aske Bisgaard Vammen for the report.
This commit is contained in:
Matt Mascarenhas 2024-01-30 15:41:30 +00:00
parent 6852d06e04
commit 77aec74483
2 changed files with 10 additions and 1 deletions

View File

@ -23,7 +23,7 @@ typedef struct
version CINERA_APP_VERSION = {
.Major = 0,
.Minor = 10,
.Patch = 27
.Patch = 28
};
#define __USE_XOPEN2K8 // NOTE(matt): O_NOFOLLOW

View File

@ -65,3 +65,12 @@ document.addEventListener("keydown", function(ev) {
ev.preventDefault();
}
});
document.addEventListener("fullscreenchange", function() {
if(!document.fullscreenElement && CineraProps.V == views.SUPERTHEATRE)
{
CineraProps.V = views.THEATRE;
localStorage.setItem(player.cineraViewStorageItem, views.THEATRE);
player.updateSize();
}
});