diff options
Diffstat (limited to 'ext/js/app/popup.js')
-rw-r--r-- | ext/js/app/popup.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/ext/js/app/popup.js b/ext/js/app/popup.js index 8bf1d7c9..347cbb84 100644 --- a/ext/js/app/popup.js +++ b/ext/js/app/popup.js @@ -142,7 +142,7 @@ class Popup extends EventDispatcher { async containsPoint(x, y) { for (let popup = this; popup !== null && popup.isVisibleSync(); popup = popup.child) { const rect = popup.getFrameRect(); - if (x >= rect.left && y >= rect.top && x < rect.right && y < rect.bottom) { + if (rect.valid && x >= rect.x && y >= rect.y && x < rect.x + rect.width && y < rect.y + rect.height) { return true; } } @@ -203,12 +203,13 @@ class Popup extends EventDispatcher { } getFrameRect() { - return this._frame.getBoundingClientRect(); + const {left, top, width, height} = this._frame.getBoundingClientRect(); + return {x: left, y: top, width, height, valid: true}; } async getFrameSize() { - const rect = this._frame.getBoundingClientRect(); - return {width: rect.width, height: rect.height, valid: true}; + const {width, height} = this._frame.getBoundingClientRect(); + return {width, height, valid: true}; } async setFrameSize(width, height) { @@ -535,16 +536,16 @@ class Popup extends EventDispatcher { const verticalOffset = optionsGeneral.popupVerticalOffset * offsetScale; const [x, w] = this._getConstrainedPosition( - elementRect.right - horizontalOffset, - elementRect.left + horizontalOffset, + elementRect.x + elementRect.width - horizontalOffset, + elementRect.x + horizontalOffset, width, viewport.left, viewport.right, true ); const [y, h, below] = this._getConstrainedPositionBinary( - elementRect.top - verticalOffset, - elementRect.bottom + verticalOffset, + elementRect.y - verticalOffset, + elementRect.y + elementRect.height + verticalOffset, height, viewport.top, viewport.bottom, |