fix: placement cells missing width/height and incorrect positioning
- Add width/height (30px) to .placement-cell CSS so cells are visible - Account for CSS grid gap (1px) in placement cell positioning - Set width/height dynamically in JS for consistency
This commit is contained in:
@@ -10,6 +10,7 @@ function initGame() {
|
||||
const sessionId = window.GAME_SESSION_ID;
|
||||
const boardSize = window.BOARD_SIZE;
|
||||
const cellSize = window.CELL_SIZE || 30;
|
||||
const cellGap = 1;
|
||||
|
||||
let selectedPieceId = null;
|
||||
let currentPlacements = [];
|
||||
@@ -155,8 +156,10 @@ function initGame() {
|
||||
const x = cell[0], y = cell[1];
|
||||
const el = document.createElement('div');
|
||||
el.className = 'placement-cell';
|
||||
el.style.left = (x * cellSize) + 'px';
|
||||
el.style.top = (y * cellSize) + 'px';
|
||||
el.style.left = (x * (cellSize + cellGap)) + 'px';
|
||||
el.style.top = (y * (cellSize + cellGap)) + 'px';
|
||||
el.style.width = cellSize + 'px';
|
||||
el.style.height = cellSize + 'px';
|
||||
el.dataset.action = placement.action;
|
||||
el.addEventListener('click', function() { makeMove(placement.action); });
|
||||
overlay.appendChild(el);
|
||||
|
||||
Reference in New Issue
Block a user