about summary refs log tree commit diff stats
path: root/html
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2025-01-10 20:53:23 -0500
committerelioat <elioat@tilde.institute>2025-01-10 20:53:23 -0500
commita82654b7d043b85649a25a20c33baa42ecc35c29 (patch)
treef4598a1f3eea9bc6eef19472e8bd3b4f83888089 /html
parentfc1c72a236ab3530d2ae151873accb55160ced44 (diff)
downloadtour-a82654b7d043b85649a25a20c33baa42ecc35c29.tar.gz
*
Diffstat (limited to 'html')
-rw-r--r--html/cards/script.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/html/cards/script.js b/html/cards/script.js
index 3c6869c..9f11282 100644
--- a/html/cards/script.js
+++ b/html/cards/script.js
@@ -155,6 +155,11 @@ const handleMouseDown = e => {
     const clickedCard = gameState.cards.slice().reverse().find(card => isPointInCard(x, y, card));
     if (clickedCard) {
         gameState.draggingCard = clickedCard;
+
+        // Move the dragged card to the top of the stack
+        gameState.cards = gameState.cards.filter(card => card !== clickedCard);
+        gameState.cards.push(clickedCard);
+
         document.addEventListener('mousemove', handleMouseMove);
         document.addEventListener('mouseup', handleMouseUp);
     }