From c935121682e50d6b7a8c2e24a5e7383523813d28 Mon Sep 17 00:00:00 2001 From: isoo127 Date: Fri, 25 Sep 2026 21:09:54 +0900 Subject: [PATCH] hotfix: fix admin page wrong click response when mobile issue --- src/main/resources/templates/admin/puzzle-add.html | 5 +++-- src/main/resources/templates/admin/puzzle-edit.html | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/resources/templates/admin/puzzle-add.html b/src/main/resources/templates/admin/puzzle-add.html index e236a1c..aeb4864 100644 --- a/src/main/resources/templates/admin/puzzle-add.html +++ b/src/main/resources/templates/admin/puzzle-add.html @@ -339,8 +339,9 @@

Add Puzzle

canvas.addEventListener('click', (e) => { const rect = canvas.getBoundingClientRect(); - const x = e.clientX - rect.left; - const y = e.clientY - rect.top; + const scale = CANVAS_LOGICAL_SIZE / rect.width; // Responsive display size to logical coordinate correction + const x = (e.clientX - rect.left) * scale; + const y = (e.clientY - rect.top) * scale; const col = Math.round((x - MARGIN) / CELL_SIZE); const row = 14 - Math.round((y - MARGIN) / CELL_SIZE); diff --git a/src/main/resources/templates/admin/puzzle-edit.html b/src/main/resources/templates/admin/puzzle-edit.html index ebe19a1..8077051 100644 --- a/src/main/resources/templates/admin/puzzle-edit.html +++ b/src/main/resources/templates/admin/puzzle-edit.html @@ -320,8 +320,9 @@

Edit Puzzle

canvas.addEventListener('click', (e) => { const rect = canvas.getBoundingClientRect(); - const x = e.clientX - rect.left; - const y = e.clientY - rect.top; + const scale = CANVAS_LOGICAL_SIZE / rect.width; // Responsive display size to logical coordinate correction + const x = (e.clientX - rect.left) * scale; + const y = (e.clientY - rect.top) * scale; const col = Math.round((x - MARGIN) / CELL_SIZE); const row = 14 - Math.round((y - MARGIN) / CELL_SIZE); if (row < 0 || row >= BOARD_SIZE || col < 0 || col >= BOARD_SIZE) return;