From b32852cf3c849cec6b52ba219d8b31e4ef8a209a Mon Sep 17 00:00:00 2001 From: Dragomir Denev Date: Wed, 19 Jun 2024 17:40:44 +0300 Subject: [PATCH] fixes #1261 --- src/directives/LongPress.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/directives/LongPress.js b/src/directives/LongPress.js index 05df102b..d56f05cd 100644 --- a/src/directives/LongPress.js +++ b/src/directives/LongPress.js @@ -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);