@codexo/exojs-tilemap 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Options for constructing a {@link WangSet}.
3
+ */
4
+ export interface WangSetOptions {
5
+ /** Which TileSet contains the Wang tiles (index into the layer's tilesets array). */
6
+ tilesetIndex: number;
7
+ /**
8
+ * Map from Wang bitmask to local tile ID within the tileset.
9
+ *
10
+ * For blob mode (8-neighbor), keys are 0–255; the 47 valid combinations
11
+ * of the blob encoding must be covered at minimum.
12
+ * For edge mode (4-neighbor), keys are 0–15.
13
+ *
14
+ * Accepts either a {@link ReadonlyMap} or a plain `Record<number, number>`.
15
+ */
16
+ blobMap: ReadonlyMap<number, number> | Record<number, number>;
17
+ /** Whether this is a blob (8-neighbor, default) or edge (4-neighbor) Wang set. */
18
+ type?: 'blob' | 'edge';
19
+ /**
20
+ * Extra local tile IDs that count as belonging to this Wang group, beyond
21
+ * the variant IDs already present as {@link blobMap} *values*.
22
+ *
23
+ * Membership is what {@link autoTile} / `refreshCell` use to decide whether a
24
+ * neighbouring cell is "part of the terrain". Because every value in
25
+ * `blobMap` is itself a member, group membership stays stable no matter which
26
+ * variant a cell currently shows — that is what makes incremental
27
+ * `refreshCell` correct. Add the *base* tile ID you paint with here if it is
28
+ * not already one of the blobMap variants.
29
+ */
30
+ members?: Iterable<number>;
31
+ }
32
+ /**
33
+ * Describes a Wang autotile set: a mapping from a neighbor bitmask to a
34
+ * local tile ID within a specific tileset.
35
+ *
36
+ * Blob bitmask bit layout (powers of 2):
37
+ * - Bit 0 (1): Top-left
38
+ * - Bit 1 (2): Top
39
+ * - Bit 2 (4): Top-right
40
+ * - Bit 3 (8): Left
41
+ * - Bit 4 (16): Right
42
+ * - Bit 5 (32): Bottom-left
43
+ * - Bit 6 (64): Bottom
44
+ * - Bit 7 (128): Bottom-right
45
+ *
46
+ * Diagonal (corner) bits are only set when both adjacent cardinal directions
47
+ * are also set — reducing 256 raw combinations to 47 meaningful blob states.
48
+ *
49
+ * Edge bitmask bit layout:
50
+ * - Bit 0 (1): Top
51
+ * - Bit 1 (2): Right
52
+ * - Bit 2 (4): Bottom
53
+ * - Bit 3 (8): Left
54
+ */
55
+ export declare class WangSet {
56
+ /** Index of the tileset that contains the Wang tiles. */
57
+ readonly tilesetIndex: number;
58
+ /** The Wang mode: `'blob'` (8-neighbor) or `'edge'` (4-neighbor). */
59
+ readonly type: 'blob' | 'edge';
60
+ private readonly _map;
61
+ private readonly _members;
62
+ constructor(options: WangSetOptions);
63
+ /**
64
+ * Look up the local tile ID for a given neighbor bitmask.
65
+ * Returns `undefined` if the mask has no mapping in this set.
66
+ */
67
+ getTileId(mask: number): number | undefined;
68
+ /**
69
+ * Whether a local tile ID belongs to this Wang group. True for every variant
70
+ * the set produces plus any explicit {@link WangSetOptions.members}. Used as
71
+ * the default, variant-stable neighbour-membership test by {@link autoTile}
72
+ * and `refreshCell`.
73
+ */
74
+ isMember(localTileId: number): boolean;
75
+ /** Read-only view of the full bitmask → tile-ID mapping. */
76
+ get blobMap(): ReadonlyMap<number, number>;
77
+ /** Read-only view of the local tile IDs that count as group members. */
78
+ get members(): ReadonlySet<number>;
79
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Describes a Wang autotile set: a mapping from a neighbor bitmask to a
3
+ * local tile ID within a specific tileset.
4
+ *
5
+ * Blob bitmask bit layout (powers of 2):
6
+ * - Bit 0 (1): Top-left
7
+ * - Bit 1 (2): Top
8
+ * - Bit 2 (4): Top-right
9
+ * - Bit 3 (8): Left
10
+ * - Bit 4 (16): Right
11
+ * - Bit 5 (32): Bottom-left
12
+ * - Bit 6 (64): Bottom
13
+ * - Bit 7 (128): Bottom-right
14
+ *
15
+ * Diagonal (corner) bits are only set when both adjacent cardinal directions
16
+ * are also set — reducing 256 raw combinations to 47 meaningful blob states.
17
+ *
18
+ * Edge bitmask bit layout:
19
+ * - Bit 0 (1): Top
20
+ * - Bit 1 (2): Right
21
+ * - Bit 2 (4): Bottom
22
+ * - Bit 3 (8): Left
23
+ */
24
+ class WangSet {
25
+ /** Index of the tileset that contains the Wang tiles. */
26
+ tilesetIndex;
27
+ /** The Wang mode: `'blob'` (8-neighbor) or `'edge'` (4-neighbor). */
28
+ type;
29
+ _map;
30
+ _members;
31
+ constructor(options) {
32
+ this.tilesetIndex = options.tilesetIndex;
33
+ this.type = options.type ?? 'blob';
34
+ if (options.blobMap instanceof Map) {
35
+ this._map = options.blobMap;
36
+ }
37
+ else {
38
+ const map = new Map();
39
+ for (const [k, v] of Object.entries(options.blobMap)) {
40
+ map.set(Number(k), v);
41
+ }
42
+ this._map = map;
43
+ }
44
+ // Members default to every variant tile ID the set can produce, so that any
45
+ // autotiled variant is recognised as part of the group (variant-stable
46
+ // membership). Explicit `members` (e.g. the base paint ID) are added on top.
47
+ const members = new Set(this._map.values());
48
+ if (options.members) {
49
+ for (const id of options.members)
50
+ members.add(id);
51
+ }
52
+ this._members = members;
53
+ }
54
+ /**
55
+ * Look up the local tile ID for a given neighbor bitmask.
56
+ * Returns `undefined` if the mask has no mapping in this set.
57
+ */
58
+ getTileId(mask) {
59
+ return this._map.get(mask);
60
+ }
61
+ /**
62
+ * Whether a local tile ID belongs to this Wang group. True for every variant
63
+ * the set produces plus any explicit {@link WangSetOptions.members}. Used as
64
+ * the default, variant-stable neighbour-membership test by {@link autoTile}
65
+ * and `refreshCell`.
66
+ */
67
+ isMember(localTileId) {
68
+ return this._members.has(localTileId);
69
+ }
70
+ /** Read-only view of the full bitmask → tile-ID mapping. */
71
+ get blobMap() {
72
+ return this._map;
73
+ }
74
+ /** Read-only view of the local tile IDs that count as group members. */
75
+ get members() {
76
+ return this._members;
77
+ }
78
+ }
79
+
80
+ export { WangSet };
81
+ //# sourceMappingURL=WangSet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WangSet.js","sources":["../../../src/WangSet.ts"],"sourcesContent":[null],"names":[],"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;IACvC;;AAGA,IAAA,IAAW,OAAO,GAAA;QAChB,OAAO,IAAI,CAAC,IAAI;IAClB;;AAGA,IAAA,IAAW,OAAO,GAAA;QAChB,OAAO,IAAI,CAAC,QAAQ;IACtB;AACD;;;;"}
@@ -0,0 +1,83 @@
1
+ import type { TileLayer } from './TileLayer';
2
+ import type { WangSet } from './WangSet';
3
+ /**
4
+ * Options for {@link autoTile} and {@link refreshCell}.
5
+ */
6
+ export interface AutoTileOptions {
7
+ /**
8
+ * When provided, only cells for which `matchFn` returns `true` are treated
9
+ * as part of the Wang group. The function receives the cell's `localTileId`,
10
+ * `tilesetIndex`, and tile coordinates `(x, y)`.
11
+ *
12
+ * If omitted, group membership defaults to {@link WangSet.isMember} on the
13
+ * cell's `localTileId` (and a matching `tilesetIndex`). That default is
14
+ * *variant-stable* — every autotiled variant counts as a member — which is
15
+ * what makes {@link refreshCell} correct. If you supply a `matchFn` for use
16
+ * with `refreshCell`, it MUST likewise be variant-stable (independent of the
17
+ * currently-rendered variant), e.g. keyed on a separate logical-terrain grid
18
+ * or a tile property.
19
+ */
20
+ matchFn?: (localTileId: number, tilesetIndex: number, x: number, y: number) => boolean;
21
+ /**
22
+ * When `true` (default), out-of-bounds neighbors are treated as though
23
+ * they belong to the Wang group, so border tiles fill correctly to the
24
+ * layer edge. Set to `false` to leave border tiles visually open.
25
+ */
26
+ wrapBorder?: boolean;
27
+ }
28
+ /**
29
+ * Apply Wang autotiling to `layer` using `wangSet`.
30
+ *
31
+ * Iterates every cell in the layer. For each cell that belongs to the Wang
32
+ * group, computes a neighbor bitmask and looks up the correct local tile ID
33
+ * from {@link WangSet.blobMap}. The layer is mutated in place; cells whose
34
+ * computed bitmask has no mapping in the blobMap are left unchanged.
35
+ *
36
+ * The function performs two passes (snapshot then write) so neighbor tests
37
+ * always reflect the pre-call state regardless of processing order.
38
+ *
39
+ * **Group membership.** With no `matchFn`, a cell belongs to the group when its
40
+ * `tilesetIndex` matches {@link WangSet.tilesetIndex} and its `localTileId` is a
41
+ * {@link WangSet.isMember member} of the set. Membership covers every variant
42
+ * the set can produce, so re-running `autoTile` (or {@link refreshCell}) on
43
+ * already-autotiled data is stable. Paint with a tile ID that is a member (a
44
+ * blobMap value, or one listed in {@link WangSetOptions.members}).
45
+ *
46
+ * **Blob mode bitmask (bit positions):**
47
+ * ```
48
+ * 1 | 2 | 4
49
+ * 8 | -- | 16
50
+ * 32 | 64 | 128
51
+ * ```
52
+ * Diagonal bits (1, 4, 32, 128) are only set when both adjacent cardinals
53
+ * are also set (the "corner dependency" rule that reduces 256 raw
54
+ * combinations to 47 valid blob states).
55
+ *
56
+ * **Edge mode bitmask (bit positions):** Top=1, Right=2, Bottom=4, Left=8.
57
+ */
58
+ export declare function autoTile(layer: TileLayer, wangSet: WangSet, options?: AutoTileOptions): void;
59
+ /**
60
+ * Incrementally re-autotile a single cell and its eight neighbours after an
61
+ * edit, instead of re-running {@link autoTile} over the whole layer.
62
+ *
63
+ * A cell's blob/edge mask depends only on its immediate neighbours, so painting
64
+ * or erasing cell `(x, y)` can change the variant of that cell and of the (up
65
+ * to) eight cells that have it as a neighbour — but nothing further out. This
66
+ * recomputes exactly that 3×3 neighbourhood, touching only the 1–4 chunks it
67
+ * spans (and rebuilding geometry only for chunks whose tiles actually change).
68
+ * For a paint operation this is O(1) work versus `autoTile`'s O(width·height).
69
+ *
70
+ * Membership is read live from the layer, so the membership test MUST be
71
+ * variant-stable: the default ({@link WangSet.isMember}) is, and any custom
72
+ * `matchFn` you pass must be too (see {@link AutoTileOptions.matchFn}).
73
+ *
74
+ * Typical editor use: write the painted tile with `layer.setTileAt(...)` using
75
+ * a member tile ID, then call `refreshCell(layer, x, y, wangSet)`.
76
+ *
77
+ * @param layer The layer to update in place.
78
+ * @param x Tile X of the edited cell.
79
+ * @param y Tile Y of the edited cell.
80
+ * @param wangSet The Wang set to resolve variants from.
81
+ * @param options Membership / border options (shared with {@link autoTile}).
82
+ */
83
+ export declare function refreshCell(layer: TileLayer, x: number, y: number, wangSet: WangSet, options?: AutoTileOptions): void;
@@ -0,0 +1,214 @@
1
+ import { unpackTile, TILE_TRANSFORM_IDENTITY } from './types.js';
2
+
3
+ // ── Module-level mask helpers ─────────────────────────────────────────────
4
+ /**
5
+ * Compute a 4-bit edge bitmask for the cell at `(tx, ty)`.
6
+ * Top=1, Right=2, Bottom=4, Left=8.
7
+ */
8
+ function computeEdgeMask(tx, ty, inGroup) {
9
+ let mask = 0;
10
+ if (inGroup(tx, ty - 1))
11
+ mask |= 1;
12
+ if (inGroup(tx + 1, ty))
13
+ mask |= 2;
14
+ if (inGroup(tx, ty + 1))
15
+ mask |= 4;
16
+ if (inGroup(tx - 1, ty))
17
+ mask |= 8;
18
+ return mask;
19
+ }
20
+ /**
21
+ * Compute an 8-bit blob bitmask for the cell at `(tx, ty)` using the
22
+ * corner-dependency rule: diagonal bits are only set when both adjacent
23
+ * cardinal directions are also set.
24
+ *
25
+ * Bit layout:
26
+ * ```
27
+ * 1 | 2 | 4
28
+ * 8 | -- | 16
29
+ * 32 | 64 | 128
30
+ * ```
31
+ */
32
+ function computeBlobMask(tx, ty, inGroup) {
33
+ const top = inGroup(tx, ty - 1);
34
+ const right = inGroup(tx + 1, ty);
35
+ const bottom = inGroup(tx, ty + 1);
36
+ const left = inGroup(tx - 1, ty);
37
+ let mask = 0;
38
+ if (top)
39
+ mask |= 2;
40
+ if (right)
41
+ mask |= 16;
42
+ if (bottom)
43
+ mask |= 64;
44
+ if (left)
45
+ mask |= 8;
46
+ // Corner bits: only when BOTH adjacent cardinals are set.
47
+ if (top && left && inGroup(tx - 1, ty - 1))
48
+ mask |= 1;
49
+ if (top && right && inGroup(tx + 1, ty - 1))
50
+ mask |= 4;
51
+ if (bottom && left && inGroup(tx - 1, ty + 1))
52
+ mask |= 32;
53
+ if (bottom && right && inGroup(tx + 1, ty + 1))
54
+ mask |= 128;
55
+ return mask;
56
+ }
57
+ /** Compute the mask for a cell given the Wang mode and a membership predicate. */
58
+ function computeMask(wangSet, tx, ty, inGroup) {
59
+ return wangSet.type === 'edge'
60
+ ? computeEdgeMask(tx, ty, inGroup)
61
+ : computeBlobMask(tx, ty, inGroup);
62
+ }
63
+ /**
64
+ * Apply the variant computed for cell `(tx, ty)` to `layer`, preserving the
65
+ * cell's current orientation transform. No-op if the mask has no mapping or
66
+ * the target tileset is missing.
67
+ */
68
+ function applyVariant(layer, wangSet, tx, ty, inGroup) {
69
+ const newLocalTileId = wangSet.getTileId(computeMask(wangSet, tx, ty, inGroup));
70
+ if (newLocalTileId === undefined)
71
+ return;
72
+ const tileset = layer.tilesets[wangSet.tilesetIndex];
73
+ if (!tileset)
74
+ return;
75
+ // Preserve the existing orientation transform if the cell already holds one.
76
+ const existing = layer.getTileAt(tx, ty);
77
+ layer.setTileAt(tx, ty, {
78
+ localTileId: newLocalTileId,
79
+ tileset,
80
+ transform: existing ? existing.transform : TILE_TRANSFORM_IDENTITY,
81
+ });
82
+ }
83
+ // ── Public API ────────────────────────────────────────────────────────────
84
+ /**
85
+ * Apply Wang autotiling to `layer` using `wangSet`.
86
+ *
87
+ * Iterates every cell in the layer. For each cell that belongs to the Wang
88
+ * group, computes a neighbor bitmask and looks up the correct local tile ID
89
+ * from {@link WangSet.blobMap}. The layer is mutated in place; cells whose
90
+ * computed bitmask has no mapping in the blobMap are left unchanged.
91
+ *
92
+ * The function performs two passes (snapshot then write) so neighbor tests
93
+ * always reflect the pre-call state regardless of processing order.
94
+ *
95
+ * **Group membership.** With no `matchFn`, a cell belongs to the group when its
96
+ * `tilesetIndex` matches {@link WangSet.tilesetIndex} and its `localTileId` is a
97
+ * {@link WangSet.isMember member} of the set. Membership covers every variant
98
+ * the set can produce, so re-running `autoTile` (or {@link refreshCell}) on
99
+ * already-autotiled data is stable. Paint with a tile ID that is a member (a
100
+ * blobMap value, or one listed in {@link WangSetOptions.members}).
101
+ *
102
+ * **Blob mode bitmask (bit positions):**
103
+ * ```
104
+ * 1 | 2 | 4
105
+ * 8 | -- | 16
106
+ * 32 | 64 | 128
107
+ * ```
108
+ * Diagonal bits (1, 4, 32, 128) are only set when both adjacent cardinals
109
+ * are also set (the "corner dependency" rule that reduces 256 raw
110
+ * combinations to 47 valid blob states).
111
+ *
112
+ * **Edge mode bitmask (bit positions):** Top=1, Right=2, Bottom=4, Left=8.
113
+ */
114
+ function autoTile(layer, wangSet, options) {
115
+ const matchFn = options?.matchFn;
116
+ const wrapBorder = options?.wrapBorder ?? true;
117
+ const w = layer.width;
118
+ const h = layer.height;
119
+ const snapshot = new Map();
120
+ for (let ty = 0; ty < h; ty++) {
121
+ for (let tx = 0; tx < w; tx++) {
122
+ const packed = layer.getRawTileAt(tx, ty);
123
+ if (packed === 0)
124
+ continue;
125
+ const decoded = unpackTile(packed);
126
+ if (!decoded)
127
+ continue;
128
+ snapshot.set(ty * w + tx, decoded);
129
+ }
130
+ }
131
+ // ── Membership test (reads the snapshot) ─────────────────────────────
132
+ const isInGroup = (nx, ny) => {
133
+ if (nx < 0 || nx >= w || ny < 0 || ny >= h)
134
+ return wrapBorder;
135
+ const cell = snapshot.get(ny * w + nx);
136
+ if (!cell)
137
+ return false;
138
+ if (matchFn)
139
+ return matchFn(cell.localTileId, cell.tilesetIndex, nx, ny);
140
+ return cell.tilesetIndex === wangSet.tilesetIndex && wangSet.isMember(cell.localTileId);
141
+ };
142
+ // ── Pass 2: compute masks and write ──────────────────────────────────
143
+ for (let ty = 0; ty < h; ty++) {
144
+ for (let tx = 0; tx < w; tx++) {
145
+ const cellInfo = snapshot.get(ty * w + tx);
146
+ if (!cellInfo)
147
+ continue;
148
+ // Skip cells that are not part of the group.
149
+ const isMember = matchFn
150
+ ? matchFn(cellInfo.localTileId, cellInfo.tilesetIndex, tx, ty)
151
+ : cellInfo.tilesetIndex === wangSet.tilesetIndex && wangSet.isMember(cellInfo.localTileId);
152
+ if (!isMember)
153
+ continue;
154
+ applyVariant(layer, wangSet, tx, ty, isInGroup);
155
+ }
156
+ }
157
+ }
158
+ /**
159
+ * Incrementally re-autotile a single cell and its eight neighbours after an
160
+ * edit, instead of re-running {@link autoTile} over the whole layer.
161
+ *
162
+ * A cell's blob/edge mask depends only on its immediate neighbours, so painting
163
+ * or erasing cell `(x, y)` can change the variant of that cell and of the (up
164
+ * to) eight cells that have it as a neighbour — but nothing further out. This
165
+ * recomputes exactly that 3×3 neighbourhood, touching only the 1–4 chunks it
166
+ * spans (and rebuilding geometry only for chunks whose tiles actually change).
167
+ * For a paint operation this is O(1) work versus `autoTile`'s O(width·height).
168
+ *
169
+ * Membership is read live from the layer, so the membership test MUST be
170
+ * variant-stable: the default ({@link WangSet.isMember}) is, and any custom
171
+ * `matchFn` you pass must be too (see {@link AutoTileOptions.matchFn}).
172
+ *
173
+ * Typical editor use: write the painted tile with `layer.setTileAt(...)` using
174
+ * a member tile ID, then call `refreshCell(layer, x, y, wangSet)`.
175
+ *
176
+ * @param layer The layer to update in place.
177
+ * @param x Tile X of the edited cell.
178
+ * @param y Tile Y of the edited cell.
179
+ * @param wangSet The Wang set to resolve variants from.
180
+ * @param options Membership / border options (shared with {@link autoTile}).
181
+ */
182
+ function refreshCell(layer, x, y, wangSet, options) {
183
+ const matchFn = options?.matchFn;
184
+ const wrapBorder = options?.wrapBorder ?? true;
185
+ const w = layer.width;
186
+ const h = layer.height;
187
+ // Live membership test (reads the current layer; variant-stable by default).
188
+ const isInGroup = (nx, ny) => {
189
+ if (nx < 0 || nx >= w || ny < 0 || ny >= h)
190
+ return wrapBorder;
191
+ const tile = layer.getTileAt(nx, ny);
192
+ if (!tile)
193
+ return false;
194
+ const tsi = layer.tilesets.indexOf(tile.tileset);
195
+ if (matchFn)
196
+ return matchFn(tile.localTileId, tsi, nx, ny);
197
+ return tsi === wangSet.tilesetIndex && wangSet.isMember(tile.localTileId);
198
+ };
199
+ // Recompute the edited cell and its eight neighbours.
200
+ for (let dy = -1; dy <= 1; dy++) {
201
+ for (let dx = -1; dx <= 1; dx++) {
202
+ const tx = x + dx;
203
+ const ty = y + dy;
204
+ if (!layer.inBounds(tx, ty))
205
+ continue;
206
+ if (!isInGroup(tx, ty))
207
+ continue;
208
+ applyVariant(layer, wangSet, tx, ty, isInGroup);
209
+ }
210
+ }
211
+ }
212
+
213
+ export { autoTile, refreshCell };
214
+ //# sourceMappingURL=autoTile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoTile.js","sources":["../../../src/autoTile.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA8BA;AAEA;;;AAGG;AACH,SAAS,eAAe,CACtB,EAAU,EACV,EAAU,EACV,OAA4C,EAAA;IAE5C,IAAI,IAAI,GAAG,CAAC;AACZ,IAAA,IAAI,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QAAE,IAAI,IAAI,CAAC;AAClC,IAAA,IAAI,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;QAAE,IAAI,IAAI,CAAC;AAClC,IAAA,IAAI,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QAAE,IAAI,IAAI,CAAC;AAClC,IAAA,IAAI,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;QAAE,IAAI,IAAI,CAAC;AAClC,IAAA,OAAO,IAAI;AACb;AAEA;;;;;;;;;;;AAWG;AACH,SAAS,eAAe,CACtB,EAAU,EACV,EAAU,EACV,OAA4C,EAAA;IAE5C,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;IACjC,MAAM,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;IAChC,IAAI,IAAI,GAAG,CAAC;AACZ,IAAA,IAAI,GAAG;QAAE,IAAI,IAAI,CAAC;AAClB,IA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jB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;gBAAE;AAC7B,YAAA,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;gBAAE;YACxB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC;QACjD;IACF;AACF;;;;"}
@@ -70,9 +70,10 @@ function buildChunkPages(chunk, tilesets, tileWidth, tileHeight) {
70
70
  const u1 = (sx + rect.width) / textureWidth;
71
71
  const v1 = (sy + rect.height) / textureHeight;
72
72
  // Bottom-left aligned destination (Tiled orthogonal). Uniform tiles
73
- // (rect.height === tileHeight) collapse to a plain cell rect.
74
- const x0 = lx * tileWidth;
75
- const y0 = ly * tileHeight + tileHeight - rect.height;
73
+ // (rect.height === tileHeight) collapse to a plain cell rect. The
74
+ // tileset's visual draw offset (Tiled `tileoffset`) shifts every tile.
75
+ const x0 = lx * tileWidth + tileset.offsetX;
76
+ const y0 = ly * tileHeight + tileHeight - rect.height + tileset.offsetY;
76
77
  const x1 = x0 + rect.width;
77
78
  const y1 = y0 + rect.height;
78
79
  let bucket = buckets.get(tileset);
@@ -1 +1 @@
1
- {"version":3,"file":"chunkGeometry.js","sources":["../../../src/chunkGeometry.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAgDA;AACM,SAAU,UAAU,CAAC,SAAwB,EAAA;AACjD,IAAA,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7F;AAmBA;;;;;;;;;;;;;;;;;;;;AAoBG;AACG,SAAU,eAAe,CAC7B,KAAwB,EACxB,QAA4B,EAC5B,SAAiB,EACjB,UAAkB,EAAA;AAIlB,IAAA,IAAI,KAAK,CAAC,KAAK,EAAE;AACf,QAAA,OAAO,E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AAG,CAAC,OAAO,EAAE,MAAM,CAAC;YAC9B;AAEA,YAAA,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACxF;IACF;;IAGA,MAAM,KAAK,GAAgB,EAAE;AAE7B,IAAA,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;QAElC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;AAC3C,YAAA,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;QAClE;IACF;AAEA,IAAA,OAAO,KAAK;AACd;;;;"}
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { tilemapExtension } from './tilemapExtension.js';
2
+ export { ImageLayer } from './ImageLayer.js';
2
3
  export { ObjectKind, ObjectLayer } from './ObjectLayer.js';
3
4
  export { TileLayer } from './TileLayer.js';
4
5
  export { TileMap } from './TileMap.js';
@@ -7,5 +8,8 @@ export { TileLayerNode } from './TileLayerNode.js';
7
8
  export { TileMapNode } from './TileMapNode.js';
8
9
  export { TileMapBand } from './TileMapBand.js';
9
10
  export { TileMapView } from './TileMapView.js';
10
- export { TILE_TRANSFORM_IDENTITY, tileToChunkCoord, tileToLocalInChunk } from './types.js';
11
+ export { TILE_TRANSFORM_IDENTITY, TilePropertyKind, tileToChunkCoord, tileToLocalInChunk } from './types.js';
12
+ export { TileAnimator } from './TileAnimator.js';
13
+ export { autoTile, refreshCell } from './autoTile.js';
14
+ export { WangSet } from './WangSet.js';
11
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -1,6 +1,8 @@
1
1
  export { tilemapExtension } from './tilemapExtension';
2
2
  export type { Extension } from '@codexo/exojs/extensions';
3
- export type { EllipseObject, ObjectLayerOptions, ObjectPoint, ObjectQuery, ObjectSchema, PointObject, PolygonObject, PolylineObject, RectangleObject, TileMapObject, TileMapObjectKind, TileObject, TypedObject, } from './ObjectLayer';
3
+ export type { ImageLayerOptions } from './ImageLayer';
4
+ export { ImageLayer } from './ImageLayer';
5
+ export type { EllipseObject, ObjectLayerOptions, ObjectPoint, ObjectQuery, ObjectSchema, PointObject, PolygonObject, PolylineObject, RectangleObject, TextObject, TextStyle, TileMapObject, TileMapObjectKind, TileObject, TypedObject, } from './ObjectLayer';
4
6
  export { ObjectKind, ObjectLayer } from './ObjectLayer';
5
7
  export type { ReadonlyTileChunk } from './TileChunk';
6
8
  export type { TileLayerOptions } from './TileLayer';
@@ -16,5 +18,10 @@ export { TileMapNode } from './TileMapNode';
16
18
  export { TileMapBand } from './TileMapBand';
17
19
  export type { TileLayerSelector, TileMapBandDefinition, TileMapViewOptions, } from './TileMapView';
18
20
  export { TileMapView } from './TileMapView';
19
- export type { ChunkCoord, PackedTile, ResolvedTile, TileDefinition, TileProperties, TilePropertyValue, TileTransform, } from './types';
20
- export { TILE_TRANSFORM_IDENTITY, tileToChunkCoord, tileToLocalInChunk, } from './types';
21
+ export type { ChunkCoord, PackedTile, ResolvedTile, TileAnimationFrame, TileDefinition, TileProperties, TilePropertyObjectRef, TilePropertyPoint, TilePropertyTileRef, TilePropertyValue, TileTransform, } from './types';
22
+ export { TILE_TRANSFORM_IDENTITY, TilePropertyKind, tileToChunkCoord, tileToLocalInChunk, } from './types';
23
+ export { TileAnimator } from './TileAnimator';
24
+ export type { AutoTileOptions } from './autoTile';
25
+ export { autoTile, refreshCell } from './autoTile';
26
+ export type { WangSetOptions } from './WangSet';
27
+ export { WangSet } from './WangSet';
@@ -1,5 +1,6 @@
1
1
  import { ExtensionRegistry } from '@codexo/exojs/extensions';
2
2
  import { tilemapExtension } from './tilemapExtension.js';
3
+ export { ImageLayer } from './ImageLayer.js';
3
4
  export { ObjectKind, ObjectLayer } from './ObjectLayer.js';
4
5
  export { TileLayer } from './TileLayer.js';
5
6
  export { TileMap } from './TileMap.js';
@@ -8,7 +9,10 @@ export { TileLayerNode } from './TileLayerNode.js';
8
9
  export { TileMapNode } from './TileMapNode.js';
9
10
  export { TileMapBand } from './TileMapBand.js';
10
11
  export { TileMapView } from './TileMapView.js';
11
- export { TILE_TRANSFORM_IDENTITY, tileToChunkCoord, tileToLocalInChunk } from './types.js';
12
+ export { TILE_TRANSFORM_IDENTITY, TilePropertyKind, tileToChunkCoord, tileToLocalInChunk } from './types.js';
13
+ export { TileAnimator } from './TileAnimator.js';
14
+ export { autoTile, refreshCell } from './autoTile.js';
15
+ export { WangSet } from './WangSet.js';
12
16
 
13
17
  // @codexo/exojs-tilemap/register — explicit registration entry.
14
18
  // Importing this entry registers the default tilemapExtension descriptor
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sources":["../../../src/register.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAMA,iBAAiB,CAAC,QAAQ,CAAC,gBAAgB,CAAC;;;;"}
1
+ {"version":3,"file":"register.js","sources":["../../../src/register.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAMA,iBAAiB,CAAC,QAAQ,CAAC,gBAAgB,CAAC;;;;"}