diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-01-10 19:26:31 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-01-10 19:26:31 -0800 |
commit | 20c5ca1bf5edc79de8b29bc1cdbd4241fd3c080a (patch) | |
tree | 6e905748fa2c4b3ffa3f82a7b7c1768e4d205db5 /ext/fg/js/popup.js | |
parent | 01d73dd2ad0c0e302f2770b704f7f8cef824bb4f (diff) |
fix annoying popup window behavior near window borders
Diffstat (limited to 'ext/fg/js/popup.js')
-rw-r--r-- | ext/fg/js/popup.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 21f4a9d7..d47ab4ae 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -46,16 +46,14 @@ class Popup { let x = elementRect.left; 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 = 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; } |