Fix draw/recycle logic and add visual recycle indicator

This commit is contained in:
chris 2026-05-25 00:58:20 -04:00
parent 91d4bcc25f
commit 82b0c00585
2 changed files with 24 additions and 5 deletions

View File

@ -44,6 +44,17 @@
background: var(--card-bg);
}
#pyramid-stock:empty::before {
content: '↺';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 32px;
opacity: 0.3;
color: var(--text-color);
}
.card.is-selected {
outline: 4px solid var(--glow);
box-shadow: 0 0 20px var(--glow);

View File

@ -373,15 +373,23 @@
// ====== EVENT LISTENERS ======
gameBoard.addEventListener('click', (e) => {
if (!isActive) return;
const cardEl = e.target.closest('.card');
if (cardEl) {
handleCardClick(cardEl.dataset.id);
const pileEl = e.target.closest('.pile');
// Check if we clicked the stock pile OR a card that is currently in the stock
const isStockClick = (pileEl && pileEl.id === 'pyramid-stock') ||
(cardEl && stock.some(c => c.id === cardEl.dataset.id));
if (isStockClick) {
handleStockClick();
return;
}
const pileEl = e.target.closest('.pile');
if (pileEl && pileEl.id === 'pyramid-stock') {
handleStockClick();
if (cardEl) {
handleCardClick(cardEl.dataset.id);
return;
}
});