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 sessionId = window.GAME_SESSION_ID;
|
||||||
const boardSize = window.BOARD_SIZE;
|
const boardSize = window.BOARD_SIZE;
|
||||||
const cellSize = window.CELL_SIZE || 30;
|
const cellSize = window.CELL_SIZE || 30;
|
||||||
|
const cellGap = 1;
|
||||||
|
|
||||||
let selectedPieceId = null;
|
let selectedPieceId = null;
|
||||||
let currentPlacements = [];
|
let currentPlacements = [];
|
||||||
@@ -155,8 +156,10 @@ function initGame() {
|
|||||||
const x = cell[0], y = cell[1];
|
const x = cell[0], y = cell[1];
|
||||||
const el = document.createElement('div');
|
const el = document.createElement('div');
|
||||||
el.className = 'placement-cell';
|
el.className = 'placement-cell';
|
||||||
el.style.left = (x * cellSize) + 'px';
|
el.style.left = (x * (cellSize + cellGap)) + 'px';
|
||||||
el.style.top = (y * cellSize) + 'px';
|
el.style.top = (y * (cellSize + cellGap)) + 'px';
|
||||||
|
el.style.width = cellSize + 'px';
|
||||||
|
el.style.height = cellSize + 'px';
|
||||||
el.dataset.action = placement.action;
|
el.dataset.action = placement.action;
|
||||||
el.addEventListener('click', function() { makeMove(placement.action); });
|
el.addEventListener('click', function() { makeMove(placement.action); });
|
||||||
overlay.appendChild(el);
|
overlay.appendChild(el);
|
||||||
|
|||||||
@@ -205,6 +205,8 @@ h3 {
|
|||||||
|
|
||||||
.placement-cell {
|
.placement-cell {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
background: rgba(255, 204, 0, 0.25);
|
background: rgba(255, 204, 0, 0.25);
|
||||||
border: 1px dashed rgba(255, 204, 0, 0.7);
|
border: 1px dashed rgba(255, 204, 0, 0.7);
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
|
|||||||
Reference in New Issue
Block a user