summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-01-11 20:25:00 -0800
committerAlex Yatskov <alex@foosoft.net>2017-01-11 20:25:00 -0800
commitdcd17bc65472ccae01ee7bbca8d00d344032e2df (patch)
treec27e2b46256e15be3db1e5f3f9c8bf54e59df24f /ext
parent916751420e28bb055fbf162ffcbf6663c6b828a8 (diff)
porting popup window dimension calculation fix
Diffstat (limited to 'ext')
-rw-r--r--ext/fg/js/popup.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 398e975e..8e71fefa 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -38,21 +38,21 @@ class Popup {
showNextTo(elementRect, content) {
this.inject();
- const containerRect = this.container.getBoundingClientRect();
+ const containerStyle = window.getComputedStyle(this.container);
+ const containerHeight = parseInt(containerStyle.height);
+ const containerWidth = parseInt(containerStyle.width);
let x = elementRect.left;
- let width = containerRect.width;
+ let width = containerWidth;
if (x + width >= window.innerWidth) {
- const widthMax = window.innerWidth - x;
- width = Math.min(width, widthMax);
+ width = Math.min(width, x);
x = window.innerWidth - width;
}
let y = elementRect.bottom + this.offset;
- let height = containerRect.height;
+ let height = containerHeight;
if (y + height >= window.innerHeight) {
- const heightMax = window.innerHeight - y - this.offset;
- height = Math.min(height, heightMax);
+ height = Math.min(height, y);
y = elementRect.top - height - this.offset;
}