resizing for orientation change
This commit is contained in:
parent
3d7e93947b
commit
95b135a9b7
5 changed files with 24 additions and 40 deletions
|
|
@ -233,7 +233,7 @@ const index = (() => {
|
|||
window.scrollTo(0, 0);
|
||||
FullScreenOverride = true;
|
||||
}
|
||||
|
||||
navigation.resize();
|
||||
UpdateFullScreenNavigate();
|
||||
};
|
||||
|
||||
|
|
@ -254,6 +254,7 @@ const index = (() => {
|
|||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
}
|
||||
navigation.resize();
|
||||
};
|
||||
|
||||
const btnNavigateMenuClick = () => {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ const navigation = (() => {
|
|||
let almanac;
|
||||
|
||||
const init = async () => {
|
||||
// nothing to do
|
||||
// set up resize handler
|
||||
window.addEventListener('resize', resize);
|
||||
};
|
||||
|
||||
const message = (data) => {
|
||||
|
|
@ -262,6 +263,20 @@ const navigation = (() => {
|
|||
return almanac.getSun();
|
||||
};
|
||||
|
||||
// resize the container on a page resize
|
||||
const resize = () => {
|
||||
const widthZoomPercent = window.innerWidth / 640;
|
||||
const heightZoomPercent = window.innerHeight / 480;
|
||||
|
||||
const scale = Math.min(widthZoomPercent, heightZoomPercent);
|
||||
|
||||
if (scale < 1.0 || document.fullscreenElement) {
|
||||
document.getElementById('container').style.zoom = scale;
|
||||
} else {
|
||||
document.getElementById('container').style.zoom = 1;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
init,
|
||||
message,
|
||||
|
|
@ -273,5 +288,6 @@ const navigation = (() => {
|
|||
getDisplay,
|
||||
getCurrentWeather,
|
||||
getSun,
|
||||
resize,
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue