Skip to content

Commit 0c4762d

Browse files
Copilotbrunoborges
andcommitted
Improve touch gesture detection and event handling
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
1 parent 23a1ecb commit 0c4762d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@
198198
// Only track touches on the card-code area
199199
if (!e.target.closest('.card-code')) return;
200200

201-
touchStartX = e.changedTouches[0].screenX;
202-
touchStartY = e.changedTouches[0].screenY;
201+
touchStartX = e.changedTouches[0].clientX;
202+
touchStartY = e.changedTouches[0].clientY;
203203
isSwiping = false;
204204
}, { passive: true });
205205

@@ -214,8 +214,8 @@
214214
// Only handle touches on the card-code area
215215
if (!e.target.closest('.card-code')) return;
216216

217-
touchEndX = e.changedTouches[0].screenX;
218-
touchEndY = e.changedTouches[0].screenY;
217+
touchEndX = e.changedTouches[0].clientX;
218+
touchEndY = e.changedTouches[0].clientY;
219219

220220
const deltaX = touchEndX - touchStartX;
221221
const deltaY = touchEndY - touchStartY;
@@ -245,6 +245,7 @@
245245
card.addEventListener('click', (e) => {
246246
if (e.target.closest('.card-code')) {
247247
e.preventDefault();
248+
e.stopPropagation();
248249
}
249250
});
250251
});

0 commit comments

Comments
 (0)