Fix draw/recycle logic and add visual recycle indicator
This commit is contained in:
parent
91d4bcc25f
commit
82b0c00585
11
pyramid.css
11
pyramid.css
@ -44,6 +44,17 @@
|
|||||||
background: var(--card-bg);
|
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 {
|
.card.is-selected {
|
||||||
outline: 4px solid var(--glow);
|
outline: 4px solid var(--glow);
|
||||||
box-shadow: 0 0 20px var(--glow);
|
box-shadow: 0 0 20px var(--glow);
|
||||||
|
|||||||
18
pyramid.js
18
pyramid.js
@ -373,15 +373,23 @@
|
|||||||
|
|
||||||
// ====== EVENT LISTENERS ======
|
// ====== EVENT LISTENERS ======
|
||||||
gameBoard.addEventListener('click', (e) => {
|
gameBoard.addEventListener('click', (e) => {
|
||||||
|
if (!isActive) return;
|
||||||
|
|
||||||
const cardEl = e.target.closest('.card');
|
const cardEl = e.target.closest('.card');
|
||||||
if (cardEl) {
|
const pileEl = e.target.closest('.pile');
|
||||||
handleCardClick(cardEl.dataset.id);
|
|
||||||
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pileEl = e.target.closest('.pile');
|
if (cardEl) {
|
||||||
if (pileEl && pileEl.id === 'pyramid-stock') {
|
handleCardClick(cardEl.dataset.id);
|
||||||
handleStockClick();
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user