diff options
Diffstat (limited to 'ext/js/app/popup-factory.js')
-rw-r--r-- | ext/js/app/popup-factory.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/ext/js/app/popup-factory.js b/ext/js/app/popup-factory.js index fb4a7b8b..bef687ff 100644 --- a/ext/js/app/popup-factory.js +++ b/ext/js/app/popup-factory.js @@ -250,7 +250,9 @@ class PopupFactory { async _onApiContainsPoint({id, x, y}) { const popup = this._getPopup(id); - [x, y] = this._convertPopupPointToRootPagePoint(popup, x, y); + const offset = this._getPopupOffset(popup); + x += offset.x; + y += offset.y; return await popup.containsPoint(x, y); } @@ -258,9 +260,13 @@ class PopupFactory { const popup = this._getPopup(id); if (!this._popupCanShow(popup)) { return; } - const {elementRect} = details; - if (typeof elementRect !== 'undefined') { - [elementRect.x, elementRect.y] = this._convertPopupPointToRootPagePoint(popup, elementRect.x, elementRect.y); + const offset = this._getPopupOffset(popup); + const {sourceRects} = details; + for (const sourceRect of sourceRects) { + sourceRect.left += offset.x; + sourceRect.top += offset.y; + sourceRect.right += offset.x; + sourceRect.bottom += offset.y; } return await popup.showContent(details, displayDetails); @@ -311,16 +317,15 @@ class PopupFactory { return popup; } - _convertPopupPointToRootPagePoint(popup, x, y) { + _getPopupOffset(popup) { const {parent} = popup; if (parent !== null) { const popupRect = parent.getFrameRect(); if (popupRect.valid) { - x += popupRect.x; - y += popupRect.y; + return {x: popupRect.left, y: popupRect.top}; } } - return [x, y]; + return {x: 0, y: 0}; } _popupCanShow(popup) { |