Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
on Safari there is no resize event on mobile, so if your browser has …
Browse files Browse the repository at this point in the history
…a toolbar that can be toggled (it will change the container size), you need to also handle the resize event by calling `.stage.updateScreenSize();`, the patch is removed from UIStage.ts in this commit.
  • Loading branch information
jcyuan committed Dec 10, 2018
1 parent f880460 commit 33862f1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/display/UIStage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,19 +389,13 @@ namespace fgui {
let resizeCheckTimer: number = NaN;

function resizeHandler(): void {

let onSafari = !!window.navigator.userAgent.match(/Version\/\d+\.\d\x20Mobile\/\S+\x20Safari/);

resizeCheckTimer = NaN;
UIStageInst.forEach(stage => {
if (onSafari) stage.offsetY = (document.body.clientHeight || document.documentElement.clientHeight) - window.innerHeight;
stage.updateScreenSize();
});
}

utils.DOMEventManager.inst.on('resize', function() {
if (isNaN(resizeCheckTimer)) {
resizeCheckTimer = window.setTimeout(resizeHandler, 300);
}
clearTimeout(resizeCheckTimer);
resizeCheckTimer = window.setTimeout(resizeHandler, 300);
});
}

0 comments on commit 33862f1

Please sign in to comment.