Merge branch 'master' of https://github.com/FooSoft/yomichan
This commit is contained in:
commit
39cf302eef
@ -55,6 +55,8 @@ function docImposterCreate(element) {
|
|||||||
document.body.appendChild(imposter);
|
document.body.appendChild(imposter);
|
||||||
imposter.scrollTop = element.scrollTop;
|
imposter.scrollTop = element.scrollTop;
|
||||||
imposter.scrollLeft = element.scrollLeft;
|
imposter.scrollLeft = element.scrollLeft;
|
||||||
|
|
||||||
|
return imposter;
|
||||||
}
|
}
|
||||||
|
|
||||||
function docImposterDestroy() {
|
function docImposterDestroy() {
|
||||||
@ -65,11 +67,12 @@ function docImposterDestroy() {
|
|||||||
|
|
||||||
function docRangeFromPoint(point) {
|
function docRangeFromPoint(point) {
|
||||||
const element = document.elementFromPoint(point.x, point.y);
|
const element = document.elementFromPoint(point.x, point.y);
|
||||||
|
let imposter = null;
|
||||||
if (element) {
|
if (element) {
|
||||||
if (element.nodeName === 'IMG' || element.nodeName === 'BUTTON') {
|
if (element.nodeName === 'IMG' || element.nodeName === 'BUTTON') {
|
||||||
return new TextSourceElement(element);
|
return new TextSourceElement(element);
|
||||||
} else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
|
} else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
|
||||||
docImposterCreate(element);
|
imposter = docImposterCreate(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +89,14 @@ function docRangeFromPoint(point) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const range = document.caretRangeFromPoint(point.x, point.y);
|
const range = document.caretRangeFromPoint(point.x, point.y);
|
||||||
|
|
||||||
|
if(imposter !== null) imposter.style.zIndex = -2147483646;
|
||||||
|
|
||||||
|
const rect = range.getClientRects()[0];
|
||||||
|
if (point.y > rect.bottom + 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (range) {
|
if (range) {
|
||||||
return new TextSourceRange(range);
|
return new TextSourceRange(range);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user