Merge pull request #208 from toasted-nutbread/fix-popup-orphans
Fix nested popups being shown if parent is hidden
This commit is contained in:
commit
ab2db771ad
@ -116,12 +116,14 @@ class PopupProxyHost {
|
|||||||
async termsShow(id, elementRect, writingMode, definitions, options, context) {
|
async termsShow(id, elementRect, writingMode, definitions, options, context) {
|
||||||
const popup = this.getPopup(id);
|
const popup = this.getPopup(id);
|
||||||
elementRect = this.jsonRectToDOMRect(popup, elementRect);
|
elementRect = this.jsonRectToDOMRect(popup, elementRect);
|
||||||
|
if (!PopupProxyHost.popupCanShow(popup)) { return false; }
|
||||||
return await popup.termsShow(elementRect, writingMode, definitions, options, context);
|
return await popup.termsShow(elementRect, writingMode, definitions, options, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
async kanjiShow(id, elementRect, writingMode, definitions, options, context) {
|
async kanjiShow(id, elementRect, writingMode, definitions, options, context) {
|
||||||
const popup = this.getPopup(id);
|
const popup = this.getPopup(id);
|
||||||
elementRect = this.jsonRectToDOMRect(popup, elementRect);
|
elementRect = this.jsonRectToDOMRect(popup, elementRect);
|
||||||
|
if (!PopupProxyHost.popupCanShow(popup)) { return false; }
|
||||||
return await popup.kanjiShow(elementRect, writingMode, definitions, options, context);
|
return await popup.kanjiShow(elementRect, writingMode, definitions, options, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +131,10 @@ class PopupProxyHost {
|
|||||||
const popup = this.getPopup(id);
|
const popup = this.getPopup(id);
|
||||||
return popup.clearAutoPlayTimer();
|
return popup.clearAutoPlayTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static popupCanShow(popup) {
|
||||||
|
return popup.parent === null || popup.parent.isVisible();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupProxyHost.instance = PopupProxyHost.create();
|
PopupProxyHost.instance = PopupProxyHost.create();
|
||||||
|
Loading…
Reference in New Issue
Block a user