Skip to content

Commit

Permalink
Exit fullscreen with correct old size.
Browse files Browse the repository at this point in the history
  • Loading branch information
pfh committed Aug 15, 2023
1 parent 5af71e4 commit 9145037
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
6 changes: 2 additions & 4 deletions inst/htmlwidgets/langevitour.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,8 @@ HTMLWidgets.widget({
// Supplied width and height are based on getBoundingClientRect.
// Wrong eg when using revealjs and slide is scaled.
// Ignore.
width = el.offsetWidth;
height = el.offsetHeight;

tour.resize(width, height);
//
// tour.resize(width, height);
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion inst/htmlwidgets/lib/langevitour-pack.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/htmlwidgets/lib/langevitour-pack.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions lib/langevitour.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/langevitour.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/langevitour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ export class Langevitour extends EventTarget {

let handleWindowSize = () => {
let el = this.shadowDiv;
if (document.fullscreenElement !== el)
if (document.fullscreenElement !== el || this.originalWidth < 0)
return;
let width = window.innerWidth;
let height = window.innerHeight;
Expand All @@ -408,8 +408,10 @@ export class Langevitour extends EventTarget {
let el = this.shadowDiv;
if (document.fullscreenElement === el) {
// Stash original size
this.originalWidth = this.width;
this.originalHeight = this.height;
if (this.originalWidth < 0) {
this.originalWidth = this.width;
this.originalHeight = this.height;
}
handleWindowSize();
// ... further window resize events may occur while full screen ...
} else if (this.originalWidth >= 0) {
Expand Down

0 comments on commit 9145037

Please sign in to comment.