Skip to content

Commit

Permalink
Fix wrong resizing when exiting full screen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Feb 26, 2024
1 parent 9b99813 commit 7f15b0c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/assets/javascripts/thyme/components/full_screen_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,18 @@ class FullScreenButton extends Component {

#fullscreenChange() {
if (document.fullscreenElement) {
// User enters fullscreen mode
this.element.innerHTML = "fullscreen_exit";
this.element.dataset.status = "true";
/* Set height to 100vh in fullscreen mode as it otherwise
is too large. */
$(thymeAttributes.video).css("height", "100vh");
}
else {
// User exists fullscreen mode
this.element.innerHTML = "fullscreen";
this.element.dataset.status = "false";
$(thymeAttributes.video).css("height", "100%");
/* brute force patch: apparently, after exiting fullscreen mode,
window.onresize is triggered twice(!), the second time with incorrect
window height data, which results in a video area not quite filling
the whole window. The next line resizes the container again. */
setTimeout(Resizer.resizeContainer($(this.container), 1, 0), 20);
}
}
}

0 comments on commit 7f15b0c

Please sign in to comment.