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