summaryrefslogtreecommitdiff
path: root/ext/fg/js/popup.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-18 13:13:12 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-22 20:38:21 -0500
commit04727a8cd7dc29a02595690389979ec1070bbded (patch)
treef65ee3f50b3536c03f70c096c0ca323156b7a853 /ext/fg/js/popup.js
parent2f994a7e5d52ee664e2229a6217dddaf993ff856 (diff)
Fix viewport issues when popupScaleRelativeToVisualViewport is disabled
Diffstat (limited to 'ext/fg/js/popup.js')
-rw-r--r--ext/fg/js/popup.js24
1 files changed, 17 insertions, 7 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index ef1334bd..e7dae93e 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -502,16 +502,26 @@ class Popup {
}
static _getViewport(useVisualViewport) {
- if (useVisualViewport) {
- const visualViewport = window.visualViewport;
- if (visualViewport !== null && typeof visualViewport === 'object') {
- const left = visualViewport.offsetLeft;
- const top = visualViewport.offsetTop;
+ const visualViewport = window.visualViewport;
+ if (visualViewport !== null && typeof visualViewport === 'object') {
+ const left = visualViewport.offsetLeft;
+ const top = visualViewport.offsetTop;
+ const width = visualViewport.width;
+ const height = visualViewport.height;
+ if (useVisualViewport) {
return {
left,
top,
- right: left + visualViewport.width,
- bottom: top + visualViewport.height
+ right: left + width,
+ bottom: top + height
+ };
+ } else {
+ const scale = visualViewport.scale;
+ return {
+ left: 0,
+ top: 0,
+ right: Math.max(left + width, width * scale),
+ bottom: Math.max(top + height, height * scale)
};
}
}