Merge pull request #164 from toasted-nutbread/document-range-fix
Fix docRangeFromPoint sometimes not returning results
This commit is contained in:
commit
672eb55a20
@ -97,19 +97,11 @@ function docRangeFromPoint(point) {
|
||||
if(imposter !== null) imposter.style.zIndex = -2147483646;
|
||||
|
||||
const rects = range.getClientRects();
|
||||
|
||||
if (rects.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rect = rects[0];
|
||||
if (point.y > rect.bottom + 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (range) {
|
||||
for (const rect of rects) {
|
||||
if (point.y <= rect.bottom + 2) {
|
||||
return new TextSourceRange(range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function docSentenceExtract(source, extent) {
|
||||
|
Loading…
Reference in New Issue
Block a user