Reverted to commit a06d538170
This commit is contained in:
+5
-6
@@ -75,11 +75,10 @@ const Snake = () => {
|
||||
const maxHeight = window.innerHeight - 420;
|
||||
return Math.min(Math.floor(maxWidth / GRID_SIZE), Math.floor(maxHeight / GRID_SIZE), 18);
|
||||
}
|
||||
// Desktop: calculate based on available height (subtract header ~60px, margins ~40px)
|
||||
const availableHeight = window.innerHeight - 100;
|
||||
const maxCellFromHeight = Math.floor(availableHeight / GRID_SIZE);
|
||||
// Clamp to reasonable max
|
||||
return Math.min(maxCellFromHeight, 30);
|
||||
if (gameMode === '2p') {
|
||||
return isFullscreen ? 20 : 16;
|
||||
}
|
||||
return isFullscreen ? 28 : 24;
|
||||
}, [isFullscreen, gameMode]);
|
||||
|
||||
const [cellSize, setCellSize] = useState(getCellSize);
|
||||
@@ -539,7 +538,7 @@ const Snake = () => {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className={`flex ${isMobile ? 'flex-col items-center' : 'flex-row gap-4 items-start justify-center'} flex-1`}>
|
||||
<div className={`flex ${isMobile ? 'flex-col items-center' : 'flex-row gap-4'} flex-1 ${isFullscreen ? 'justify-center items-center' : ''}`}>
|
||||
<div className="border-2 border-primary box-glow p-1 bg-background/80">
|
||||
<div className="grid" style={{ gridTemplateColumns: `repeat(${GRID_SIZE}, ${cellSize}px)` }}>
|
||||
{gameMode === '1p' ? renderGrid1P() : renderGrid2P()}
|
||||
|
||||
Reference in New Issue
Block a user