This commit is contained in:
Dragomir Denev 2024-06-19 17:40:44 +03:00
parent f0f87dbb11
commit b32852cf3c

View File

@ -39,11 +39,17 @@ export default {
document.removeEventListener('pointerup', onPointerUp);
};
const onPointerMove = () => {
clearTimeout(parseInt(el.dataset.longPressTimeout, 10));
document.removeEventListener('pointermove', onPointerMove);
};
const onPointerDown = (e) => {
// If event was right-click, then immediately trigger
if (e.button === 2) return;
startTime = Date.now();
document.addEventListener('pointerup', onPointerUp);
el.addEventListener('pointermove', onPointerMove);
el.addEventListener('click', swallowClick);
const timeoutDuration = LONG_PRESS_DEFAULT_DELAY;
const timeout = setTimeout(triggerEvent, timeoutDuration);