diff options
| author | Hunternif | 2019-04-13 15:54:57 +0700 |
|---|---|---|
| committer | Hunternif | 2019-04-13 16:02:26 +0700 |
| commit | e88676b69b7c74558e7b1b586ffd1cda101b9077 (patch) | |
| tree | 21566492b988dadcdd92330bbea088e187b7287a /client | |
| parent | 2959c0a973c8439bf239aa9869b145be1173b3dc (diff) | |
Attempt to fix inconsistent post image resizing
Diffstat (limited to 'client')
| -rw-r--r-- | client/js/controls/post_content_control.js | 10 | ||||
| -rw-r--r-- | client/js/views/post_main_view.js | 6 |
2 files changed, 7 insertions, 9 deletions
diff --git a/client/js/controls/post_content_control.js b/client/js/controls/post_content_control.js index e445c75..3407776 100644 --- a/client/js/controls/post_content_control.js +++ b/client/js/controls/post_content_control.js @@ -94,7 +94,7 @@ class PostContentControl { } _resize(width, height) { - this._resizePostContainer(width, height); + this._resizePostContent(width, height); const resizeListenerNodes = this._postContentNode.querySelectorAll('.resize-listener'); for (let node of resizeListenerNodes) { node.style.width = width + 'px'; @@ -102,10 +102,10 @@ class PostContentControl { } } - _resizePostContainer(width, height) { - // on mobile don't make the image narrower than the screen, so that small images are centered - if (screen.width < 1000) { - // use browser width to accommodate Android's on-screen buttons in landscape mode + _resizePostContent(width, height) { + // on mobile don't make the content node narrower than the screen, so that small images are centered + // use browser width to accommodate Android's on-screen buttons in landscape mode + if (window.innerWidth < 1000) { width = Math.max(window.innerWidth, width); } this._postContentNode.style.width = width + 'px'; diff --git a/client/js/views/post_main_view.js b/client/js/views/post_main_view.js index 375c43c..55b57cc 100644 --- a/client/js/views/post_main_view.js +++ b/client/js/views/post_main_view.js @@ -36,10 +36,8 @@ class PostMainView { ctx.post, () => { return [ - window.innerWidth - - postContainerNode.getBoundingClientRect().left, - iosCorrectedInnerHeight() - - topNavigationNode.getBoundingClientRect().height, + postContainerNode.getBoundingClientRect().width, + iosCorrectedInnerHeight() - postContainerNode.getBoundingClientRect().top, ]; }); |