mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
correct iPad sizing
This commit is contained in:
parent
6baea9948b
commit
05dd97ffe0
@ -19,10 +19,10 @@ function calcHeight() {
|
|||||||
|
|
||||||
// iPhone shrinks header and removes footer controls ( back / forward nav )
|
// iPhone shrinks header and removes footer controls ( back / forward nav )
|
||||||
// at 39px we are at the largest viewport
|
// at 39px we are at the largest viewport
|
||||||
const smallViewport = (window.screen.height - window.innerHeight) > 40;
|
const portrait = window.innerHeight > window.innerWidth;
|
||||||
|
const smallViewport = ((portrait ? window.screen.height : window.screen.width) - window.innerHeight) > 40;
|
||||||
|
|
||||||
// portrait
|
if (portrait) {
|
||||||
if (window.screen.height > window.screen.width) {
|
|
||||||
|
|
||||||
// iPhone SE, it is super small so just
|
// iPhone SE, it is super small so just
|
||||||
// have a bit of crop
|
// have a bit of crop
|
||||||
@ -39,24 +39,22 @@ function calcHeight() {
|
|||||||
if (window.screen.height === 736) {
|
if (window.screen.height === 736) {
|
||||||
withoutKeyboard = smallViewport ? 353 : 383;
|
withoutKeyboard = smallViewport ? 353 : 383;
|
||||||
}
|
}
|
||||||
|
|
||||||
// iPad can use innerHeight cause it renders nothing in the footer
|
// iPad can use innerHeight cause it renders nothing in the footer
|
||||||
if (window.innerHeight > 920) {
|
if (window.innerHeight > 920) {
|
||||||
withoutKeyboard -= 45;
|
withoutKeyboard -= 45;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// landscape
|
// landscape
|
||||||
//
|
|
||||||
// iPad, we have a bigger keyboard
|
// iPad, we have a bigger keyboard
|
||||||
if (window.innerWidth > window.innerHeight && window.innerHeight > 665) {
|
if (window.innerHeight > 665) {
|
||||||
withoutKeyboard -= 128;
|
withoutKeyboard -= 128;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// iPad portrait also has a bigger keyboard
|
// iPad portrait also has a bigger keyboard
|
||||||
|
|
||||||
return Math.max(withoutKeyboard, min);
|
return Math.max(withoutKeyboard, min);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user