diff --git a/src/App.vue b/src/App.vue index 2675efa..46ef4ee 100644 --- a/src/App.vue +++ b/src/App.vue @@ -111,4 +111,22 @@ h1 { justify-content: center; margin-top: 10px; } + +@media (max-width: 768px) { + .game-header { + margin-top: 20px; + margin-bottom: 20px; + } + h1 { + font-size: 2.4rem; + letter-spacing: 3px; + } +} + +@media (max-width: 420px) { + h1 { + font-size: 2rem; + letter-spacing: 2px; + } +} diff --git a/src/components/Cell.vue b/src/components/Cell.vue index 02fbf1e..6fbdfca 100644 --- a/src/components/Cell.vue +++ b/src/components/Cell.vue @@ -21,10 +21,22 @@ const cellClass = computed(() => { } }); -const handleMouseDown = (e) => { - // 0 = left, 2 = right +let lastTap = 0; + +const handlePointerDown = (e) => { + if (e.pointerType === 'mouse') { if (e.button === 0) emit('start-drag', props.r, props.c, false); if (e.button === 2) emit('start-drag', props.r, props.c, true); + return; + } + const now = Date.now(); + const isDoubleTap = now - lastTap < 300; + lastTap = now; + if (isDoubleTap) { + emit('start-drag', props.r, props.c, true); + } else { + emit('start-drag', props.r, props.c, false); + } }; @@ -32,7 +44,9 @@ const handleMouseDown = (e) => {
@@ -52,6 +66,7 @@ const handleMouseDown = (e) => { align-items: center; transition: background-color 0.1s ease, box-shadow 0.1s ease; user-select: none; + touch-action: none; } .cell:hover { diff --git a/src/components/GameBoard.vue b/src/components/GameBoard.vue index 0ac7ed1..2ce2b75 100644 --- a/src/components/GameBoard.vue +++ b/src/components/GameBoard.vue @@ -1,5 +1,5 @@