Fix bird not flying to right location when iOS address bar is minimized

This commit is contained in:
Idrees Hassan
2025-10-28 23:11:46 -04:00
parent 2c0438cc0a
commit 66284b0af8
6 changed files with 106 additions and 87 deletions

View File

@@ -182,4 +182,25 @@ export function getLayer(spriteSheet, spriteIndex, width) {
layer.push(spriteSheet[y].slice(spriteIndex * width, (spriteIndex + 1) * width));
}
return layer;
}
/**
* The height of the inner browser window
* Will be the same as getFixedWindowHeight() on most browsers
* On iOS, it will vary to be the height excluding the current address bar size (potentially greater than fixed height)
*/
export function getWindowHeight() {
// Necessary because iOS 26 Safari is terrible and won't render
// fixed/sticky elements behind the address bar
return window.innerHeight;
}
/**
* The fixed height of the inner browser window
* Will be the same as getWindowHeight() on most browsers
* On iOS, it will always be the height of the window when the address bar is fully expanded
* @returns The true height of the inner browser window
*/
export function getFixedWindowHeight() {
return document.documentElement.clientHeight;
}