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);
|
||||
}
|
||||
|
||||
#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);
|
||||
|
||||
18
pyramid.js
18
pyramid.js
@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user