From bb2f1ced9904bdcd7b689e733c357ffe293279fc Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Mon, 15 Mar 2021 20:27:24 +0200 Subject: [PATCH] Position pdf-reader color popup by element instead of coordinates --- chrome/content/zotero/xpcom/reader.js | 9 +++++---- pdf-reader | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index dfd20b4286..aad34fa5ae 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -327,7 +327,7 @@ class ReaderInstance { popup.openPopupAtScreen(x, y, true); } - _openColorPopup(x, y, colors, selectedColor) { + _openColorPopup(elementID, colors, selectedColor) { let popup = this._window.document.createElement('menupopup'); this._popupset.appendChild(popup); popup.addEventListener('popuphidden', function () { @@ -349,7 +349,8 @@ class ReaderInstance { }); popup.appendChild(menuitem); } - popup.openPopupAtScreen(x, y, true); + let element = this._iframeWindow.document.getElementById(elementID); + popup.openPopup(element, 'after_start', 0, 0, true); } async _postMessage(message, transfer) { @@ -432,8 +433,8 @@ class ReaderInstance { return; } case 'openColorPopup': { - let { x, y, colors, selectedColor } = message; - this._openColorPopup(x, y, colors, selectedColor); + let { elementID, colors, selectedColor } = message; + this._openColorPopup(elementID, colors, selectedColor); return; } case 'openURL': { diff --git a/pdf-reader b/pdf-reader index 45bcf737f7..2d9d8ccd9e 160000 --- a/pdf-reader +++ b/pdf-reader @@ -1 +1 @@ -Subproject commit 45bcf737f70a90b229dd075db73f40c7fc7e4101 +Subproject commit 2d9d8ccd9ef133ea3175402ba327b75ff6641ff4