client/posts: fix viewport height calculation on iOS
This commit is contained in:
parent
2a69f0193f
commit
d39439d549
3 changed files with 10 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const iosCorrectedInnerHeight = require('ios-inner-height');
|
||||||
const router = require('../router.js');
|
const router = require('../router.js');
|
||||||
const views = require('../util/views.js');
|
const views = require('../util/views.js');
|
||||||
const uri = require('../util/uri.js');
|
const uri = require('../util/uri.js');
|
||||||
|
@ -26,23 +27,20 @@ class PostMainView {
|
||||||
views.replaceContent(this._hostNode, sourceNode);
|
views.replaceContent(this._hostNode, sourceNode);
|
||||||
views.syncScrollPosition();
|
views.syncScrollPosition();
|
||||||
|
|
||||||
const postViewNode = document.body.querySelector('.content-wrapper');
|
|
||||||
const topNavigationNode =
|
const topNavigationNode =
|
||||||
document.body.querySelector('#top-navigation');
|
document.body.querySelector('#top-navigation');
|
||||||
|
|
||||||
const margin = (
|
|
||||||
postViewNode.getBoundingClientRect().top -
|
|
||||||
topNavigationNode.getBoundingClientRect().height);
|
|
||||||
|
|
||||||
this._postContentControl = new PostContentControl(
|
this._postContentControl = new PostContentControl(
|
||||||
postContainerNode,
|
postContainerNode,
|
||||||
ctx.post,
|
ctx.post,
|
||||||
() => {
|
() => {
|
||||||
|
const margin = sidebarNode.getBoundingClientRect().left;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
window.innerWidth -
|
window.innerWidth -
|
||||||
postContainerNode.getBoundingClientRect().left -
|
postContainerNode.getBoundingClientRect().left -
|
||||||
margin,
|
margin,
|
||||||
window.innerHeight -
|
iosCorrectedInnerHeight() -
|
||||||
topNavigationNode.getBoundingClientRect().height -
|
topNavigationNode.getBoundingClientRect().height -
|
||||||
margin * 2,
|
margin * 2,
|
||||||
];
|
];
|
||||||
|
|
5
client/package-lock.json
generated
5
client/package-lock.json
generated
|
@ -1482,6 +1482,11 @@
|
||||||
"loose-envify": "1.3.1"
|
"loose-envify": "1.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ios-inner-height": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/ios-inner-height/-/ios-inner-height-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-GayJWoFxYHDx/gkfz4nIxNdsqB3nAJQHKV5pDBvig6he8+NxBSYxN+D7oarbqZfW2p6uera3q9NDr4Jgdafiog=="
|
||||||
|
},
|
||||||
"is-buffer": {
|
"is-buffer": {
|
||||||
"version": "1.1.5",
|
"version": "1.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz",
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
"font-awesome": "^4.6.1",
|
"font-awesome": "^4.6.1",
|
||||||
"glob": "^7.1.2",
|
"glob": "^7.1.2",
|
||||||
"html-minifier": "^1.3.1",
|
"html-minifier": "^1.3.1",
|
||||||
|
"ios-inner-height": "^1.0.3",
|
||||||
"js-cookie": "^2.2.0",
|
"js-cookie": "^2.2.0",
|
||||||
"js-yaml": "^3.10.0",
|
"js-yaml": "^3.10.0",
|
||||||
"marked": "^0.3.9",
|
"marked": "^0.3.9",
|
||||||
|
|
Loading…
Reference in a new issue