Skip to content

Commit ceeb3cf

Browse files
committed
Improve grid rendering compatibility
1 parent 0d6844e commit ceeb3cf

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

css/styles.css

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,9 @@ button.primary {
158158
}
159159

160160
.world-grid {
161-
--world-width: 8;
162-
--world-height: 8;
163161
display: grid;
164-
grid-template-columns: repeat(var(--world-width), minmax(52px, 1fr));
162+
grid-template-columns: repeat(12, minmax(52px, 1fr));
163+
grid-auto-rows: minmax(52px, 1fr);
165164
gap: 0.65rem;
166165
background: rgba(12, 15, 23, 0.7);
167166
padding: 0.85rem;
@@ -178,13 +177,23 @@ button.primary {
178177
align-items: center;
179178
justify-content: center;
180179
aspect-ratio: 1 / 1;
180+
min-height: 52px;
181181
overflow: hidden;
182182
padding: 0.35rem;
183183
transition: border 0.2s ease, transform 0.15s ease;
184184
color: var(--text);
185185
font: inherit;
186186
}
187187

188+
.world-tile::after {
189+
content: "";
190+
position: absolute;
191+
inset: 0;
192+
border-radius: inherit;
193+
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
194+
pointer-events: none;
195+
}
196+
188197
.world-tile img {
189198
width: 72%;
190199
pointer-events: none;

js/ui.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export class UIController {
6363
renderWorld({ placementMode }) {
6464
if (!this.worldGrid) return;
6565
const { width, height } = this.gameState.world;
66-
this.worldGrid.style.setProperty("--world-width", width);
67-
this.worldGrid.style.setProperty("--world-height", height);
66+
this.worldGrid.style.gridTemplateColumns = `repeat(${width}, minmax(52px, 1fr))`;
67+
this.worldGrid.style.gridTemplateRows = `repeat(${height}, minmax(52px, 1fr))`;
6868
this.worldGrid.innerHTML = "";
6969

7070
for (const tile of this.gameState.world.tiles()) {

0 commit comments

Comments
 (0)