fix(nds): fix attempt to cancel a touchstart event with cancelable=false

This commit is contained in:
2026-02-24 13:01:10 +01:00
parent 154740f481
commit e40dd255af

View File

@@ -93,7 +93,7 @@ const handleTouchStart = (event: TouchEvent) => {
const touch = event.touches[0]; const touch = event.touches[0];
if (!touch) return; if (!touch) return;
event.preventDefault(); if (event.cancelable) event.preventDefault();
swipeStartX = touch.clientX; swipeStartX = touch.clientX;
swipeStartY = touch.clientY; swipeStartY = touch.clientY;
@@ -193,7 +193,7 @@ onMounted(() => {
canvas.value.addEventListener("click", handleCanvasClick); canvas.value.addEventListener("click", handleCanvasClick);
canvas.value.addEventListener("mousedown", handleCanvasMouseDown); canvas.value.addEventListener("mousedown", handleCanvasMouseDown);
canvas.value.addEventListener("wheel", handleCanvasWheel, { passive: true }); canvas.value.addEventListener("wheel", handleCanvasWheel, { passive: true });
canvas.value.addEventListener("touchstart", handleTouchStart); canvas.value.addEventListener("touchstart", handleTouchStart, { passive: false });
canvas.value.addEventListener("touchend", handleTouchEnd, { passive: true }); canvas.value.addEventListener("touchend", handleTouchEnd, { passive: true });
canvas.value.addEventListener("mousedown", handleSwipeMouseDown); canvas.value.addEventListener("mousedown", handleSwipeMouseDown);
canvas.value.addEventListener("mouseup", handleSwipeMouseUp); canvas.value.addEventListener("mouseup", handleSwipeMouseUp);