The tile list in the tilemap section is a palette of pictures: each tile shows its lone tile (the four convex corners for floor and wall, the picture itself for none) with its name below, laid out with the image-picker grid (#139)
game-maker / gate (push) Successful in 1m41s
game-maker / suite (push) Successful in 6m15s

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5 committed 2026-09-18 10:15:51 +02:00
1 parent 4c411c1ff3
commit bfbcbe604c
9 files changed
+331 -28

No files matched your search

+14 -3
View File
@@ -26,10 +26,21 @@ export interface GridMetrics {
height: number;
}
export function gridMetrics(width: number, count: number, gap = TILE_GAP): GridMetrics {
const columns = Math.max(1, Math.floor((width + gap) / (TILE_MIN + gap)));
/** How small and how large a tile may get; the tile palette of a tilemap wants smaller ones (#139). */
export interface TileSizes {
min: number;
max: number;
}
export function gridMetrics(
width: number,
count: number,
gap = TILE_GAP,
sizes: TileSizes = { min: TILE_MIN, max: TILE_MAX },
): GridMetrics {
const columns = Math.max(1, Math.floor((width + gap) / (sizes.min + gap)));
const spread = (width - gap * (columns - 1)) / columns;
const tile = Math.max(TILE_MIN, Math.min(TILE_MAX, Math.floor(spread)));
const tile = Math.max(sizes.min, Math.min(sizes.max, Math.floor(spread)));
const rows = Math.ceil(count / columns);
const height = rows * (tile + CAPTION_HEIGHT) + Math.max(0, rows - 1) * gap;
return { columns, tile, rows, height };