Don't scan when touching the current selection
This commit is contained in:
parent
e23d4b9a82
commit
710ffb88fc
@ -172,7 +172,12 @@ class Frontend {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setPrimaryTouch(this.getPrimaryTouch(e.changedTouches));
|
let touch = this.getPrimaryTouch(e.changedTouches);
|
||||||
|
if (this.selectionContainsPoint(window.getSelection(), touch.clientX, touch.clientY)) {
|
||||||
|
touch = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setPrimaryTouch(touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
onTouchEnd(e) {
|
onTouchEnd(e) {
|
||||||
@ -452,6 +457,18 @@ class Frontend {
|
|||||||
|
|
||||||
search();
|
search();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectionContainsPoint(selection, x, y) {
|
||||||
|
for (let i = 0; i < selection.rangeCount; ++i) {
|
||||||
|
const range = selection.getRangeAt(i);
|
||||||
|
for (const rect of range.getClientRects()) {
|
||||||
|
if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.yomichan_frontend = new Frontend();
|
window.yomichan_frontend = new Frontend();
|
||||||
|
Loading…
Reference in New Issue
Block a user