diff options
Diffstat (limited to 'html/cards/script.js')
-rw-r--r-- | html/cards/script.js | 5 |
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); } |