mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-24 01:12:06 +03:00
fixes #1261
This commit is contained in:
parent
f0f87dbb11
commit
b32852cf3c
@ -39,11 +39,17 @@ export default {
|
|||||||
document.removeEventListener('pointerup', onPointerUp);
|
document.removeEventListener('pointerup', onPointerUp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onPointerMove = () => {
|
||||||
|
clearTimeout(parseInt(el.dataset.longPressTimeout, 10));
|
||||||
|
document.removeEventListener('pointermove', onPointerMove);
|
||||||
|
};
|
||||||
|
|
||||||
const onPointerDown = (e) => {
|
const onPointerDown = (e) => {
|
||||||
// If event was right-click, then immediately trigger
|
// If event was right-click, then immediately trigger
|
||||||
if (e.button === 2) return;
|
if (e.button === 2) return;
|
||||||
startTime = Date.now();
|
startTime = Date.now();
|
||||||
document.addEventListener('pointerup', onPointerUp);
|
document.addEventListener('pointerup', onPointerUp);
|
||||||
|
el.addEventListener('pointermove', onPointerMove);
|
||||||
el.addEventListener('click', swallowClick);
|
el.addEventListener('click', swallowClick);
|
||||||
const timeoutDuration = LONG_PRESS_DEFAULT_DELAY;
|
const timeoutDuration = LONG_PRESS_DEFAULT_DELAY;
|
||||||
const timeout = setTimeout(triggerEvent, timeoutDuration);
|
const timeout = setTimeout(triggerEvent, timeoutDuration);
|
||||||
|
Loading…
Reference in New Issue
Block a user