switch to mousemove events in query parser

This commit is contained in:
siikamiika 2019-11-03 15:45:07 +02:00
parent 8825c481b5
commit c78ca36f3d

View File

@ -36,7 +36,7 @@ class QueryParser {
this.onTermLookup(e, {disableScroll: true, selectText});
}
onMouseEnter(e) {
onMouseMove(e) {
if (
this.pendingLookup ||
(e.buttons & 0x1) !== 0x0 // Left mouse button
@ -112,11 +112,16 @@ class QueryParser {
}
activateScanning(element) {
element.addEventListener('mouseenter', (e) => {
element.addEventListener('mousemove', (e) => {
clearTimeout(e.target.dataset.timer);
if (this.search.options.scanning.modifier === 'none') {
e.target.dataset.timer = setTimeout(() => {
this.onMouseEnter(e);
this.onMouseMove(e);
delete e.target.dataset.timer;
}, this.search.options.scanning.delay);
} else {
this.onMouseMove(e);
}
});
element.addEventListener('mouseleave', (e) => {
clearTimeout(e.target.dataset.timer);