From 5476c100467e31d7dac02a4b1c14e62a4e9b34d0 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 17 Sep 2017 10:09:48 -0700 Subject: more improvements to automatic search result hiding (#71) --- ext/fg/js/popup.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ext/fg/js/popup.js') diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 03958832..d1009fe9 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -100,6 +100,21 @@ class Popup { return this.injected && this.container.style.visibility !== 'hidden'; } + containsPoint(point) { + if (!this.isVisible()) { + return false; + } + + 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 termsShow(elementRect, definitions, options, context) { await this.show(elementRect, options); this.invokeApi('termsShow', {definitions, options, context}); -- cgit v1.2.3