From 9028b55774f788f0b61acadb8d3ba85b2bfab34a Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 3 Sep 2019 18:55:55 -0400 Subject: [PATCH] Fix nested popups closing when the mouse leaves the parent's rect --- ext/fg/js/popup.js | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index df7dc6b5..1b15977b 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -251,26 +251,13 @@ class Popup { } } - async containsPoint(point) { - if (!this.isVisible()) { - return false; + async containsPoint({x, y}) { + for (let popup = this; popup !== null && popup.isVisible(); popup = popup.child) { + const rect = popup.container.getBoundingClientRect(); + if (x >= rect.left && y >= rect.top && x < rect.right && y < rect.bottom) { + return true; + } } - - const rect = this.container.getBoundingClientRect(); - const contained = - point.x >= rect.left && - point.y >= rect.top && - point.x < rect.right && - point.y < rect.bottom; - - return contained; - } - - async containsPointAsync(point) { - return containsPoint(point); - } - - containsPointIsAsync() { return false; }