Position pdf-reader color popup by element instead of coordinates

This commit is contained in:
Martynas Bagdonas 2021-03-15 20:27:24 +02:00
parent b3e46392ba
commit bb2f1ced99
2 changed files with 6 additions and 5 deletions

View file

@ -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': {

@ -1 +1 @@
Subproject commit 45bcf737f70a90b229dd075db73f40c7fc7e4101
Subproject commit 2d9d8ccd9ef133ea3175402ba327b75ff6641ff4