summaryrefslogtreecommitdiff
path: root/ext/fg/js/popup-proxy-host.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/popup-proxy-host.js')
-rw-r--r--ext/fg/js/popup-proxy-host.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js
index 041900ed..396f7556 100644
--- a/ext/fg/js/popup-proxy-host.js
+++ b/ext/fg/js/popup-proxy-host.js
@@ -42,7 +42,7 @@ class PopupProxyHost {
showOrphaned: ({id, elementRect, options}) => this.show(id, elementRect, options),
hide: ({id}) => this.hide(id),
setVisible: ({id, visible}) => this.setVisible(id, visible),
- containsPoint: ({id, point}) => this.containsPoint(id, point),
+ containsPoint: ({id, x, y}) => this.containsPoint(id, x, y),
termsShow: ({id, elementRect, writingMode, definitions, options, context}) => this.termsShow(id, elementRect, writingMode, definitions, options, context),
kanjiShow: ({id, elementRect, writingMode, definitions, options, context}) => this.kanjiShow(id, elementRect, writingMode, definitions, options, context),
clearAutoPlayTimer: ({id}) => this.clearAutoPlayTimer(id)
@@ -108,20 +108,22 @@ class PopupProxyHost {
return popup.setVisible(visible);
}
- async containsPoint(id, point) {
+ async containsPoint(id, x, y) {
const popup = this.getPopup(id);
- return await popup.containsPoint(point);
+ return await popup.containsPoint(x, y);
}
async termsShow(id, elementRect, writingMode, definitions, options, context) {
const popup = this.getPopup(id);
elementRect = this.jsonRectToDOMRect(popup, elementRect);
+ if (!PopupProxyHost.popupCanShow(popup)) { return false; }
return await popup.termsShow(elementRect, writingMode, definitions, options, context);
}
async kanjiShow(id, elementRect, writingMode, definitions, options, context) {
const popup = this.getPopup(id);
elementRect = this.jsonRectToDOMRect(popup, elementRect);
+ if (!PopupProxyHost.popupCanShow(popup)) { return false; }
return await popup.kanjiShow(elementRect, writingMode, definitions, options, context);
}
@@ -129,6 +131,10 @@ class PopupProxyHost {
const popup = this.getPopup(id);
return popup.clearAutoPlayTimer();
}
+
+ static popupCanShow(popup) {
+ return popup.parent === null || popup.parent.isVisible();
+ }
}
PopupProxyHost.instance = PopupProxyHost.create();