diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-03 18:55:55 -0400 | 
|---|---|---|
| committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-03 18:55:55 -0400 | 
| commit | 9028b55774f788f0b61acadb8d3ba85b2bfab34a (patch) | |
| tree | 822811aae7528487bc4ebb17d363cdb4b7b0b00c /ext | |
| parent | fad53324885c971a1ab1aeee3da5dd60dc5058df (diff) | |
Fix nested popups closing when the mouse leaves the parent's rect
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/fg/js/popup.js | 25 | 
1 files 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;      } |