aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/document.js
diff options
context:
space:
mode:
authorAlex Yatskov <FooSoft@users.noreply.github.com>2019-03-07 11:31:06 -0800
committerGitHub <noreply@github.com>2019-03-07 11:31:06 -0800
commitc7f8d0874a758924802179a44757153bbf18bf7f (patch)
tree3191c8015cc23667c4089cd551ec521183b61ac8 /ext/fg/js/document.js
parent27fb9643e471dbd1c0e6a19023a449bf7688bd71 (diff)
parent0b8ae6c53a4b5b358a0af0617ccada019630d683 (diff)
Merge pull request #157 from toasted-nutbread/touch-input
Add support for touch input
Diffstat (limited to 'ext/fg/js/document.js')
-rw-r--r--ext/fg/js/document.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index 9366832e..13acb036 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -85,14 +85,24 @@ function docRangeFromPoint(point) {
range.setEnd(position.offsetNode, position.offset);
return range;
}
+ return null;
};
}
const range = document.caretRangeFromPoint(point.x, point.y);
+ if (range === null) {
+ return;
+ }
if(imposter !== null) imposter.style.zIndex = -2147483646;
- const rect = range.getClientRects()[0];
+ const rects = range.getClientRects();
+
+ if (rects.length === 0) {
+ return;
+ }
+
+ const rect = rects[0];
if (point.y > rect.bottom + 2) {
return;
}