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)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c411c1ff3
commit
bfbcbe604c
9 files changed
+331
-28
No files matched your search
@@ -14,6 +14,7 @@ import type { TileAsset } from '../../src/core/model/Asset';
|
||||
import { isPlaceableType } from '../../src/core/model/AssetTypes';
|
||||
import {
|
||||
autotileCombinations,
|
||||
loneTileQuadrants,
|
||||
type Neighbours,
|
||||
neighboursAt,
|
||||
SAMPLE_PATTERN,
|
||||
@@ -249,6 +250,28 @@ describe('autotile blocks', () => {
|
||||
expect([corner.n, corner.e, corner.ne]).toEqual([true, true, false]);
|
||||
expect(tileQuadrants('floor', corner)[1]).toEqual({ x: 3, y: 0 });
|
||||
});
|
||||
|
||||
it('shows each kind in the palette as its lone tile, the four convex corners (#139)', () => {
|
||||
expect(loneTileQuadrants('floor')).toEqual([
|
||||
{ x: 0, y: 2 },
|
||||
{ x: 3, y: 2 },
|
||||
{ x: 0, y: 5 },
|
||||
{ x: 3, y: 5 },
|
||||
]);
|
||||
expect(loneTileQuadrants('wall')).toEqual([
|
||||
{ x: 0, y: 0 },
|
||||
{ x: 3, y: 0 },
|
||||
{ x: 0, y: 3 },
|
||||
{ x: 3, y: 3 },
|
||||
]);
|
||||
// A plain tile is its picture as it is, each corner its own quarter.
|
||||
expect(loneTileQuadrants('none')).toEqual([
|
||||
{ x: 0, y: 0 },
|
||||
{ x: 1, y: 0 },
|
||||
{ x: 0, y: 1 },
|
||||
{ x: 1, y: 1 },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('tile asset', () => {
|
||||
|
||||
@@ -28,6 +28,19 @@ describe('gridMetrics', () => {
|
||||
expect(gridMetrics(140, 1).tile).toBe(TILE_MAX);
|
||||
});
|
||||
|
||||
it('takes other limits for the tile size, as the tile palette of a tilemap does (#139)', () => {
|
||||
const sizes = { min: 56, max: 72 };
|
||||
// A 300 px inspector column: four boxes of 56 fit, spread to 70 each.
|
||||
const m = gridMetrics(300, 5, 6, sizes);
|
||||
expect(m.columns).toBe(4);
|
||||
expect(m.tile).toBe(70);
|
||||
expect(m.rows).toBe(2);
|
||||
expect(m.height).toBe(2 * (70 + CAPTION_HEIGHT) + 6);
|
||||
// 170 px hold two columns of 82 – capped at the upper limit, not at the picker's.
|
||||
expect(gridMetrics(170, 5, 6, sizes).tile).toBe(72);
|
||||
expect(tileAt(tileRect(1, m, 6).x + 2, 2, 5, m, 6)).toBe(1);
|
||||
});
|
||||
|
||||
it('reports the height the scroll container has to give it', () => {
|
||||
const m = gridMetrics(WIDTH, 7);
|
||||
expect(m.rows).toBe(2);
|
||||
|
||||
Reference in new issue
Block a user