summaryrefslogtreecommitdiff
path: root/ext/fg/js/popup.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-09-17 10:09:48 -0700
committerAlex Yatskov <alex@foosoft.net>2017-09-17 10:09:48 -0700
commit5476c100467e31d7dac02a4b1c14e62a4e9b34d0 (patch)
treee817af08681c24c2c4262589e5e26cb75c4ea403 /ext/fg/js/popup.js
parent9280985306f5a9c79b9bd2c4daea596a5ec78ae5 (diff)
more improvements to automatic search result hiding (#71)
Diffstat (limited to 'ext/fg/js/popup.js')
-rw-r--r--ext/fg/js/popup.js15
1 files changed, 15 insertions, 0 deletions
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});