@codexo/exojs-tilemap 0.17.0 → 0.19.0

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.
Files changed (87) hide show
  1. package/README.md +84 -109
  2. package/dist/esm/ChunkStreamer.d.ts.map +1 -1
  3. package/dist/esm/ChunkStreamer.js +28 -6
  4. package/dist/esm/ChunkStreamer.js.map +1 -1
  5. package/dist/esm/ImageLayer.d.ts +1 -1
  6. package/dist/esm/ImageLayer.d.ts.map +1 -1
  7. package/dist/esm/ImageLayerNode.d.ts +5 -1
  8. package/dist/esm/ImageLayerNode.d.ts.map +1 -1
  9. package/dist/esm/ImageLayerNode.js +7 -2
  10. package/dist/esm/ImageLayerNode.js.map +1 -1
  11. package/dist/esm/MapObject.d.ts +2 -2
  12. package/dist/esm/MapObject.d.ts.map +1 -1
  13. package/dist/esm/MapObject.js.map +1 -1
  14. package/dist/esm/MapObjectSpawner.d.ts.map +1 -1
  15. package/dist/esm/MapSpawnSession.d.ts.map +1 -1
  16. package/dist/esm/MapWorld.d.ts +8 -8
  17. package/dist/esm/MapWorld.d.ts.map +1 -1
  18. package/dist/esm/MapWorldRuntime.d.ts.map +1 -1
  19. package/dist/esm/ObjectLayer.d.ts +26 -10
  20. package/dist/esm/ObjectLayer.d.ts.map +1 -1
  21. package/dist/esm/ObjectLayer.js +28 -0
  22. package/dist/esm/ObjectLayer.js.map +1 -1
  23. package/dist/esm/SampledChunkSource.d.ts.map +1 -1
  24. package/dist/esm/TileAnimator.d.ts.map +1 -1
  25. package/dist/esm/TileChunk.d.ts.map +1 -1
  26. package/dist/esm/TileChunkNode.js +47 -10
  27. package/dist/esm/TileChunkNode.js.map +1 -1
  28. package/dist/esm/TileLayer.d.ts +11 -2
  29. package/dist/esm/TileLayer.d.ts.map +1 -1
  30. package/dist/esm/TileLayer.js +20 -10
  31. package/dist/esm/TileLayer.js.map +1 -1
  32. package/dist/esm/TileLayerNode.d.ts +12 -5
  33. package/dist/esm/TileLayerNode.d.ts.map +1 -1
  34. package/dist/esm/TileLayerNode.js +44 -24
  35. package/dist/esm/TileLayerNode.js.map +1 -1
  36. package/dist/esm/TileMap.d.ts +6 -2
  37. package/dist/esm/TileMap.d.ts.map +1 -1
  38. package/dist/esm/TileMap.js +13 -12
  39. package/dist/esm/TileMap.js.map +1 -1
  40. package/dist/esm/TileMapBand.d.ts.map +1 -1
  41. package/dist/esm/TileMapNode.d.ts +6 -1
  42. package/dist/esm/TileMapNode.d.ts.map +1 -1
  43. package/dist/esm/TileMapNode.js +12 -4
  44. package/dist/esm/TileMapNode.js.map +1 -1
  45. package/dist/esm/TileMapView.d.ts +6 -1
  46. package/dist/esm/TileMapView.d.ts.map +1 -1
  47. package/dist/esm/TileMapView.js +9 -4
  48. package/dist/esm/TileMapView.js.map +1 -1
  49. package/dist/esm/TileProjection.d.ts +59 -0
  50. package/dist/esm/TileProjection.d.ts.map +1 -0
  51. package/dist/esm/TileProjection.js +106 -0
  52. package/dist/esm/TileProjection.js.map +1 -0
  53. package/dist/esm/TileSet.d.ts.map +1 -1
  54. package/dist/esm/WangSet.d.ts.map +1 -1
  55. package/dist/esm/WorkerSampledChunkSource.d.ts +4 -7
  56. package/dist/esm/WorkerSampledChunkSource.d.ts.map +1 -1
  57. package/dist/esm/WorkerSampledChunkSource.js +12 -18
  58. package/dist/esm/WorkerSampledChunkSource.js.map +1 -1
  59. package/dist/esm/autoTile.d.ts.map +1 -1
  60. package/dist/esm/chunkGeometry.js +78 -50
  61. package/dist/esm/chunkGeometry.js.map +1 -1
  62. package/dist/esm/index.js +2 -1
  63. package/dist/esm/projectObject.d.ts +4 -0
  64. package/dist/esm/projectObject.d.ts.map +1 -0
  65. package/dist/esm/projectObject.js +87 -0
  66. package/dist/esm/projectObject.js.map +1 -0
  67. package/dist/esm/public.d.ts +1 -0
  68. package/dist/esm/public.d.ts.map +1 -1
  69. package/dist/esm/tileCollision.d.ts +2 -2
  70. package/dist/esm/tileCollision.d.ts.map +1 -1
  71. package/dist/esm/tileCollision.js +48 -16
  72. package/dist/esm/tileCollision.js.map +1 -1
  73. package/dist/esm/tilemapSerializers.js +1 -1
  74. package/dist/esm/tilemapSerializers.js.map +1 -1
  75. package/dist/esm/types.d.ts +3 -3
  76. package/dist/esm/types.d.ts.map +1 -1
  77. package/dist/esm/webgl2/WebGl2TileChunkRenderer.js +8 -7
  78. package/dist/esm/webgl2/WebGl2TileChunkRenderer.js.map +1 -1
  79. package/dist/esm/webgl2/shaders/tile-chunk.frag.js +1 -1
  80. package/dist/esm/webgl2/shaders/tile-chunk.frag.js.map +1 -1
  81. package/dist/esm/webgl2/shaders/tile-chunk.vert.js +1 -1
  82. package/dist/esm/webgl2/shaders/tile-chunk.vert.js.map +1 -1
  83. package/dist/esm/webgpu/WebGpuTileChunkRenderer.js +67 -31
  84. package/dist/esm/webgpu/WebGpuTileChunkRenderer.js.map +1 -1
  85. package/dist/esm/webgpu/shaders/tile-chunk.wgsl.js +1 -1
  86. package/dist/esm/webgpu/shaders/tile-chunk.wgsl.js.map +1 -1
  87. package/package.json +4 -4
@@ -16,14 +16,14 @@ export interface MapBounds {
16
16
  * not interpretable.
17
17
  */
18
18
  export declare const MapLevelSide: {
19
- readonly North: "north";
20
- readonly South: "south";
21
- readonly West: "west";
22
- readonly East: "east";
23
- readonly Overlap: "overlap";
24
- readonly Below: "below";
25
- readonly Above: "above";
26
- readonly Unknown: "unknown";
19
+ readonly North: 'north';
20
+ readonly South: 'south';
21
+ readonly West: 'west';
22
+ readonly East: 'east';
23
+ readonly Overlap: 'overlap';
24
+ readonly Below: 'below';
25
+ readonly Above: 'above';
26
+ readonly Unknown: 'unknown';
27
27
  };
28
28
  /** Side discriminant for a {@link MapLevelNeighbour}. */
29
29
  export type MapLevelSide = (typeof MapLevelSide)[keyof typeof MapLevelSide];
@@ -1 +1 @@
1
- {"version":3,"file":"MapWorld.d.ts","sourceRoot":"","sources":["../../src/MapWorld.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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E,MAAM,GAAG,OAAO,CAEnC;IAED,0DAA0D;IACnD,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEpC;IAEM,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACjF,SAAS,CAAC,OAAO,EAAE,MAAM,SAAS,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAwEnJ;;;;;;;OAOG;IACI,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAoBtC;IAED;;;;;;OAMG;IACI,OAAO,IAAI,IAAI,CAoBrB;YAEa,QAAQ;CAqCvB"}
@@ -1,3 +1,4 @@
1
+ import type { TileProjection } from './TileProjection';
1
2
  import type { ResolvedTile, TileProperties, TilePropertyValue } from './types';
2
3
  /**
3
4
  * Geometry kinds for a {@link TileMapObject}, as an `as const` value object.
@@ -10,13 +11,13 @@ import type { ResolvedTile, TileProperties, TilePropertyValue } from './types';
10
11
  * @stable
11
12
  */
12
13
  export declare const ObjectKind: {
13
- readonly Rectangle: "rectangle";
14
- readonly Ellipse: "ellipse";
15
- readonly Polygon: "polygon";
16
- readonly Polyline: "polyline";
17
- readonly Point: "point";
18
- readonly Tile: "tile";
19
- readonly Text: "text";
14
+ readonly Rectangle: 'rectangle';
15
+ readonly Ellipse: 'ellipse';
16
+ readonly Polygon: 'polygon';
17
+ readonly Polyline: 'polyline';
18
+ readonly Point: 'point';
19
+ readonly Tile: 'tile';
20
+ readonly Text: 'text';
20
21
  };
21
22
  /** Geometry discriminant for a {@link TileMapObject}. */
22
23
  export type ObjectKind = (typeof ObjectKind)[keyof typeof ObjectKind];
@@ -48,9 +49,9 @@ interface TileMapObjectBase<P extends TileProperties = TileProperties> {
48
49
  readonly name: string;
49
50
  /** Object class/type string (Tiled `type`/`class`; may be empty). */
50
51
  readonly type: string;
51
- /** X of the object origin in object-layer pixel space. */
52
+ /** X of the object origin in layer coordinates; logical pixels when the layer has a projection. */
52
53
  readonly x: number;
53
- /** Y of the object origin in object-layer pixel space. */
54
+ /** Y of the object origin in layer coordinates; logical pixels when the layer has a projection. */
54
55
  readonly y: number;
55
56
  /** Bounding width in px (0 for points). */
56
57
  readonly width: number;
@@ -108,6 +109,8 @@ export interface PolylineObject<P extends TileProperties = TileProperties> exten
108
109
  * map, bottom-centre on an isometric one) and rotates the tile image about
109
110
  * that point, so a non-zero {@link TileMapObjectBase.rotation} on a tile
110
111
  * object still pivots about the source anchor rather than about `(x, y)`.
112
+ * Isometric Tiled objects expose this anchor as `rotationOrigin`;
113
+ * `getDisplayObject` projects both the unrotated corner and this pivot.
111
114
  *
112
115
  * The owning tileset's drawing offset (Tiled `tileoffset`, reachable as
113
116
  * `tile.tileset.offsetX`/`offsetY`) is likewise **not** folded into `x`/`y`.
@@ -118,6 +121,8 @@ export interface PolylineObject<P extends TileProperties = TileProperties> exten
118
121
  export interface TileObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {
119
122
  readonly kind: typeof ObjectKind.Tile;
120
123
  readonly tile: ResolvedTile;
124
+ /** Image rotation pivot in layer coordinates, logical when projected. Adapters may omit it when unavailable. */
125
+ readonly rotationOrigin?: ObjectPoint;
121
126
  }
122
127
  /** Text styling options carried by a {@link TextObject}. */
123
128
  export interface TextStyle {
@@ -209,6 +214,8 @@ export interface ObjectQuery {
209
214
  }
210
215
  /** Construction options for an {@link ObjectLayer}. */
211
216
  export interface ObjectLayerOptions {
217
+ /** Object geometry uses logical pixels when supplied; display placement is available through getDisplayObject. */
218
+ readonly projection?: TileProjection;
212
219
  /** Layer id (unique within the map). */
213
220
  readonly id: number;
214
221
  /** Layer name. */
@@ -284,8 +291,10 @@ export interface ObjectLayerOptions {
284
291
  * @advanced
285
292
  */
286
293
  export declare class ObjectLayer<S extends ObjectSchema = ObjectSchema> {
294
+ /** Projection of the logical object geometry, or undefined for ordinary display-space objects. */
295
+ readonly projection: TileProjection | undefined;
287
296
  /** Layer-kind discriminant (distinguishes object layers from tile layers). */
288
- readonly kind: "object";
297
+ readonly kind: 'object';
289
298
  /** Layer id (unique within the map). */
290
299
  readonly id: number;
291
300
  /** Layer name. */
@@ -328,6 +337,13 @@ export declare class ObjectLayer<S extends ObjectSchema = ObjectSchema> {
328
337
  /** The objects in this layer (insertion order). */
329
338
  readonly objects: readonly TileMapObject[];
330
339
  constructor(options: ObjectLayerOptions);
340
+ /**
341
+ * Returns display-space geometry including the layer offset. Isometric
342
+ * rectangles become polygons; ellipses retain their exact affine shape.
343
+ * Tile/text dimensions remain display pixels. Parallax and scene transforms
344
+ * are applied by the consumer, after this conversion.
345
+ */
346
+ getDisplayObject(object: TileMapObject): TileMapObject;
331
347
  /** Objects matching every specified criterion of `filter`. Returns a fresh array. */
332
348
  query(filter?: ObjectQuery): TileMapObject[];
333
349
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectLayer.d.ts","sourceRoot":"","sources":["../../src/ObjectLayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAyB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGtG;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU;;;;;;;;CAQb,CAAC;AAEX,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEtE;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAE3C,sEAAsE;AACtE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,yDAAyD;AACzD,UAAU,iBAAiB,CAAC,CAAC,SAAS,cAAc,GAAG,cA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xC,SAAgB,UAAU,EAAE,cAAc,CAAC;IAC3C,mDAAmD;IACnD,SAAgB,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAElD,YAAmB,OAAO,EAAE,kBAAkB,EAmB7C;IAED;;;;;OAKG;IACI,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAO5D;IAED,qFAAqF;IAC9E,KAAK,CAAC,MAAM,GAAE,WAAgB,GAAG,aAAa,EAAE,CA8BtD;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAE3E;IAED;;;;OAIG;IACI,MAAM,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC,CAEvF;IAED;;;;;OAKG;IACI,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAE7H;IAED,oDAAoD;IAC7C,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE1D;IAED,sDAAsD;IAC/C,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE9D;CACF"}
@@ -76,6 +76,8 @@ const tilePropertyValueEquals = (a, b) => {
76
76
  * @advanced
77
77
  */
78
78
  var ObjectLayer = class {
79
+ /** Projection of the logical object geometry, or undefined for ordinary display-space objects. */
80
+ projection;
79
81
  /** Layer-kind discriminant (distinguishes object layers from tile layers). */
80
82
  kind = "object";
81
83
  /** Layer id (unique within the map). */
@@ -121,6 +123,7 @@ var ObjectLayer = class {
121
123
  objects;
122
124
  constructor(options) {
123
125
  this.id = options.id;
126
+ this.projection = options.projection;
124
127
  this.name = options.name ?? "";
125
128
  this.class = options.class ?? "";
126
129
  this.visible = options.visible ?? true;
@@ -136,6 +139,31 @@ var ObjectLayer = class {
136
139
  this.properties = options.properties ? Object.freeze({ ...options.properties }) : Object.freeze({});
137
140
  this.objects = options.objects ? Object.freeze([...options.objects]) : Object.freeze([]);
138
141
  }
142
+ /**
143
+ * Returns display-space geometry including the layer offset. Isometric
144
+ * rectangles become polygons; ellipses retain their exact affine shape.
145
+ * Tile/text dimensions remain display pixels. Parallax and scene transforms
146
+ * are applied by the consumer, after this conversion.
147
+ */
148
+ getDisplayObject(object) {
149
+ const projected = this.projection?.projectObject(object) ?? object;
150
+ const position = {
151
+ x: projected.x + this.offsetX,
152
+ y: projected.y + this.offsetY
153
+ };
154
+ if (projected.kind === "tile" && projected.rotationOrigin) return {
155
+ ...projected,
156
+ ...position,
157
+ rotationOrigin: {
158
+ x: projected.rotationOrigin.x + this.offsetX,
159
+ y: projected.rotationOrigin.y + this.offsetY
160
+ }
161
+ };
162
+ return {
163
+ ...projected,
164
+ ...position
165
+ };
166
+ }
139
167
  /** Objects matching every specified criterion of `filter`. Returns a fresh array. */
140
168
  query(filter = {}) {
141
169
  return this.objects.filter((object) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectLayer.js","names":[],"sources":["../../src/ObjectLayer.ts"],"sourcesContent":["import type { ResolvedTile, TileProperties, TilePropertyObjectRef, TilePropertyValue } from './types';\nimport { TilePropertyKind } from './types';\n\n/**\n * Geometry kinds for a {@link TileMapObject}, as an `as const` value object.\n *\n * Modelled as a frozen string map (not a TS `enum`) so the values stay\n * wire-compatible with the Tiled string serialisation, survive\n * `verbatimModuleSyntax` (no emitted runtime helper), and follow the package\n * convention for enum-like constants. Use the members for ergonomic, typo-safe\n * call sites: `layer.byKind(ObjectKind.Polygon)`.\n * @stable\n */\nexport const ObjectKind = {\n Rectangle: 'rectangle',\n Ellipse: 'ellipse',\n Polygon: 'polygon',\n Polyline: 'polyline',\n Point: 'point',\n Tile: 'tile',\n Text: 'text',\n} as const;\n\n/** Geometry discriminant for a {@link TileMapObject}. */\nexport type ObjectKind = (typeof ObjectKind)[keyof typeof ObjectKind];\n\n/**\n * Geometry discriminant for a {@link TileMapObject}.\n * Structural alias of {@link ObjectKind}; retained so existing code keeps\n * compiling. New code may prefer {@link ObjectKind}.\n */\nexport type TileMapObjectKind = ObjectKind;\n\n/** A point in object-layer space (pixels, relative to the object). */\nexport interface ObjectPoint {\n readonly x: number;\n readonly y: number;\n}\n\n/** Fields shared by every {@link TileMapObject} kind. */\ninterface TileMapObjectBase<P extends TileProperties = TileProperties> {\n /** Source-unique object id. */\n readonly id: number;\n /**\n * Stable string identity assigned by the authoring format, when it has one.\n *\n * LDtk sets it to the entity `iid`, which is globally unique and survives\n * re-ordering, re-export and level moves - the identity to persist in a\n * savegame. Tiled has no such field and leaves this unset; there, {@link id}\n * is the identity and it is unique only within its map.\n */\n readonly sourceId?: string;\n /** Object name (may be empty; not unique). */\n readonly name: string;\n /** Object class/type string (Tiled `type`/`class`; may be empty). */\n readonly type: string;\n /** X of the object origin in object-layer pixel space. */\n readonly x: number;\n /** Y of the object origin in object-layer pixel space. */\n readonly y: number;\n /** Bounding width in px (0 for points). */\n readonly width: number;\n /** Bounding height in px (0 for points). */\n readonly height: number;\n /**\n * Rotation in degrees, clockwise, about `(x, y)` - except on a\n * {@link TileObject}, whose pivot stays at the source format's own anchor and\n * is generally not `(x, y)`. See {@link TileObject} for why.\n */\n readonly rotation: number;\n /** Whether the object is marked visible. */\n readonly visible: boolean;\n /** Immutable custom properties. */\n readonly properties: P;\n /**\n * The raw source-format record this object was parsed from, for the rare\n * case that needs a field this model does not carry. Adapters that keep\n * their parsed document alive set it (`LdtkEntityInstance` for LDtk,\n * `TiledObject` for Tiled); a procedurally built object has none.\n *\n * Reading it ties the code to one source format - prefer the typed fields.\n */\n readonly source?: unknown;\n}\n\n/** An axis-aligned rectangle object spanning `[x, y, width, height]`. */\nexport interface RectangleObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Rectangle;\n}\n\n/** An ellipse inscribed in `[x, y, width, height]`. */\nexport interface EllipseObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Ellipse;\n}\n\n/** A single point at `(x, y)`. */\nexport interface PointObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Point;\n}\n\n/** A closed polygon; `points` are relative to the object origin. */\nexport interface PolygonObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Polygon;\n readonly points: readonly ObjectPoint[];\n}\n\n/** An open polyline; `points` are relative to the object origin. */\nexport interface PolylineObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Polyline;\n readonly points: readonly ObjectPoint[];\n}\n\n/**\n * A tile (GID) object carrying a resolved tile reference.\n *\n * `x`/`y` are the top-left corner of the bounding box, the same convention as\n * every other object kind. Source formats that anchor a tile object elsewhere\n * normalise to the corner on import: Tiled stores the position at the\n * tileset's `objectalignment` point (bottom-left by default on an orthogonal\n * map, bottom-centre on an isometric one) and rotates the tile image about\n * that point, so a non-zero {@link TileMapObjectBase.rotation} on a tile\n * object still pivots about the source anchor rather than about `(x, y)`.\n *\n * The owning tileset's drawing offset (Tiled `tileoffset`, reachable as\n * `tile.tileset.offsetX`/`offsetY`) is likewise **not** folded into `x`/`y`.\n * Object layers are data-only, so nothing in this package draws a tile object;\n * code that does has to add that offset itself to match how a tile layer\n * places the same tile.\n */\nexport interface TileObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Tile;\n readonly tile: ResolvedTile;\n}\n\n/** Text styling options carried by a {@link TextObject}. */\nexport interface TextStyle {\n /** The text content. */\n readonly text: string;\n /** Text colour as 0xRRGGBB, or `null` if default. */\n readonly color?: number | null;\n /** Font family name. */\n readonly fontFamily?: string;\n /** Font size in pixels. */\n readonly pixelSize?: number;\n /** Bold text. */\n readonly bold?: boolean;\n /** Italic text. */\n readonly italic?: boolean;\n /** Underline text. */\n readonly underline?: boolean;\n /** Strikeout text. */\n readonly strikeout?: boolean;\n /** Wrap text within the object bounds. */\n readonly wrap?: boolean;\n /** Horizontal alignment. */\n readonly halign?: 'left' | 'center' | 'right' | 'justify';\n /** Vertical alignment. */\n readonly valign?: 'top' | 'center' | 'bottom';\n}\n\n/** A text object carrying styled text content within `[x, y, width, height]`. */\nexport interface TextObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Text;\n readonly text: TextStyle;\n}\n\n/**\n * A format-independent map object. The geometry kind is the discriminant;\n * narrow on `kind` to read shape-specific fields. Template objects are not\n * yet represented.\n *\n * The optional property-shape parameter `P` lets typed accessors\n * (see {@link ObjectLayer.byType}) narrow `properties` to a developer-declared\n * schema. It defaults to the generic {@link TileProperties} bag, so the plain\n * `TileMapObject` form is unchanged.\n * @advanced\n */\nexport type TileMapObject<P extends TileProperties = TileProperties> =\n RectangleObject<P> | EllipseObject<P> | PointObject<P> | PolygonObject<P> | PolylineObject<P> | TileObject<P> | TextObject<P>;\n\n/**\n * A developer-declared mapping from object `type`/class strings to the property\n * shape an object of that type is expected to carry. Supplied as the type\n * parameter to {@link ObjectLayer} to unlock the typed accessors\n * ({@link ObjectLayer.byType}, {@link ObjectLayer.where}).\n *\n * @remarks\n * A schema is a **developer promise, not a runtime guarantee.** Tiled data is\n * untyped at runtime and ExoJS performs no validation against the schema -\n * the property objects are returned exactly as parsed. The schema only refines\n * the static type of `properties` for ergonomic, typo-safe field access. If the\n * source data does not match the declared shape, reads still succeed but the\n * static type is a fiction. Validate at the boundary if you need certainty.\n *\n * @example\n * ```ts\n * const EntityType = { Spawn: 'spawn', Pickup: 'pickup' } as const;\n * interface LevelObjects {\n * [EntityType.Spawn]: { team: 'red' | 'blue' };\n * [EntityType.Pickup]: { item: 'coin' | 'gem'; amount: number };\n * }\n * const entities = map.getObjectLayer<LevelObjects>('Entities');\n * entities.byType(EntityType.Spawn)[0].properties.team; // 'red' | 'blue'\n * ```\n * @stable\n */\nexport type ObjectSchema = Record<string, TileProperties>;\n\n/**\n * A {@link TileMapObject} whose `properties` are narrowed to the schema shape\n * declared for the object `type` `T` in schema `S`.\n * @advanced\n */\nexport type TypedObject<S extends ObjectSchema, T extends keyof S & string> = TileMapObject<S[T]>;\n\n/** Filter for {@link ObjectLayer.query}. Unspecified fields match everything. */\nexport interface ObjectQuery {\n /** Match objects whose `name` equals this. */\n readonly name?: string;\n /** Match objects whose `type`/class equals this. */\n readonly type?: string;\n /** Match objects of this geometry kind. */\n readonly kind?: TileMapObjectKind;\n /** Match objects that carry this property key. */\n readonly property?: string;\n /** When combined with `property`, also require the property value to equal this. */\n readonly value?: TilePropertyValue;\n}\n\n/**\n * Type guard for the {@link TilePropertyObjectRef} variant of\n * {@link TilePropertyValue}.\n * @internal\n */\nconst isTilePropertyObjectRef = (value: TilePropertyValue): value is TilePropertyObjectRef =>\n typeof value === 'object' && value !== null && !Array.isArray(value) && (value as { kind?: unknown }).kind === TilePropertyKind.ObjectRef;\n\n/**\n * Equality used by {@link ObjectLayer.query}'s `value` filter.\n *\n * Scalars and `null` compare with `===`. `objectRef` values compare by `id`\n * alone - the one genuinely common \"find all objects referencing X\" query\n * need - regardless of differing LDtk navigation fields. Every other\n * structured shape (`point`, `tileRef`, arrays, nested property bags) has no\n * obvious value-equality semantics (exact float coordinates? array order?)\n * and only matches when reference-identical; use `query({ property })`\n * (presence-only) for those.\n * @internal\n */\nconst tilePropertyValueEquals = (a: TilePropertyValue, b: TilePropertyValue): boolean => {\n if (a === b) return true;\n if (isTilePropertyObjectRef(a) && isTilePropertyObjectRef(b)) return a.id === b.id;\n return false;\n};\n\n/** Construction options for an {@link ObjectLayer}. */\nexport interface ObjectLayerOptions {\n /** Layer id (unique within the map). */\n readonly id: number;\n /** Layer name. */\n readonly name?: string;\n /** Layer class string. */\n readonly class?: string;\n /** Whether the layer is visible. Default `true`. */\n readonly visible?: boolean;\n /** Layer opacity in `[0, 1]`. Default `1`. */\n readonly opacity?: number;\n /** Layer pixel offset X. Default `0`. */\n readonly offsetX?: number;\n /** Layer pixel offset Y. Default `0`. */\n readonly offsetY?: number;\n /**\n * Parallax scroll factor on the X axis. `1` = full camera speed (normal),\n * `0.5` = half speed (farther away), `0` = stationary. Default `1`.\n */\n readonly parallaxX?: number;\n /**\n * Parallax scroll factor on the Y axis. `1` = full camera speed (normal),\n * `0.5` = half speed (farther away), `0` = stationary. Default `1`.\n */\n readonly parallaxY?: number;\n /** Uniform parallax scale around the layer origin. Default `1`. */\n readonly parallaxScale?: number;\n /**\n * Multiplicative layer tint as a `0xRRGGBB` integer, or `null` for no tint\n * (Tiled `tintcolor`). Default `null`.\n */\n readonly tintColor?: number | null;\n /**\n * Draw order for the objects (Tiled `draworder`): `'topdown'` (sorted by `y`)\n * or `'index'` (source order). Informational; objects are stored as given.\n * Default `'topdown'`.\n */\n readonly drawOrder?: 'topdown' | 'index';\n /** The objects in this layer. */\n readonly objects?: readonly TileMapObject[];\n /** Layer-level properties (copied and frozen). */\n readonly properties?: TileProperties;\n}\n\n/**\n * A data-only layer of {@link TileMapObject}s - spawn points, trigger zones,\n * collision regions, markers. Object layers are not rendered by the tile\n * renderer; they are parsed and exposed for gameplay use (e.g. building physics\n * colliders, placing entities).\n *\n * The presentation fields the source format attaches to a layer -\n * {@link visible}, {@link opacity}, {@link offsetX}/{@link offsetY},\n * {@link parallaxX}/{@link parallaxY}, {@link parallaxScale}, and\n * {@link tintColor} - are carried\n * through in full, with any enclosing group layers' contribution already\n * folded in, so an object layer describes the same placement and shading its\n * neighbouring tile and image layers do. Nothing here acts on them: code that\n * draws these objects itself is what applies them.\n *\n * Query with {@link query} (untyped, fully back-compatible) or, when an\n * {@link ObjectSchema} type argument `S` is supplied, with the typed accessors\n * {@link byType}, {@link byKind}, and {@link where} - these narrow `properties`\n * to the developer-declared shape. The schema is **opt-in**: the default type\n * parameter reproduces the original untyped behaviour, so\n * `new ObjectLayer(options)` and `map.getObjectLayer('x')` are unchanged.\n *\n * @remarks\n * A schema is a developer promise, not a runtime guarantee - Tiled data is\n * untyped at runtime and ExoJS performs no validation. See {@link ObjectSchema}.\n *\n * @typeParam S - Optional {@link ObjectSchema} mapping object `type` strings to\n * their property shapes. Defaults to a generic schema (every type maps to the\n * loose {@link TileProperties} bag).\n *\n * @advanced\n */\nexport class ObjectLayer<S extends ObjectSchema = ObjectSchema> {\n /** Layer-kind discriminant (distinguishes object layers from tile layers). */\n public readonly kind = 'object' as const;\n\n /** Layer id (unique within the map). */\n public readonly id: number;\n /** Layer name. */\n public readonly name: string;\n /** Layer class string. */\n public readonly class: string;\n /** Whether the layer is visible. */\n public readonly visible: boolean;\n /** Layer opacity in `[0, 1]`. */\n public readonly opacity: number;\n /** Layer pixel offset X. */\n public readonly offsetX: number;\n /** Layer pixel offset Y. */\n public readonly offsetY: number;\n /**\n * Parallax scroll factor on the X axis - the same quantity\n * {@link import('./TileLayer').TileLayer.parallaxX} carries, so an object\n * layer authored beside a tile layer in the same parallax group reports the\n * same factor. `1` = full camera speed, `0.5` = half speed, `0` =\n * stationary. Nothing in this package applies it: object layers are\n * data-only, so placing an object relative to the camera is the consumer's\n * job (see {@link ObjectLayer}).\n */\n public readonly parallaxX: number;\n /** Parallax scroll factor on the Y axis. See {@link ObjectLayer.parallaxX}. */\n public readonly parallaxY: number;\n /** Uniform scale applied around the layer origin by consumers that render this data-only layer. */\n public readonly parallaxScale: number;\n /**\n * Multiplicative layer tint as `0xRRGGBB`, or `null` for no tint. Carried\n * from the source map (including the accumulated tint of any enclosing group\n * layers) for code that draws these objects itself; like\n * {@link ObjectLayer.parallaxX}, nothing in this package applies it.\n */\n public readonly tintColor: number | null;\n /** Draw order for the objects (Tiled `draworder`). Informational. */\n public readonly drawOrder: 'topdown' | 'index';\n /** Immutable layer-level properties. */\n public readonly properties: TileProperties;\n /** The objects in this layer (insertion order). */\n public readonly objects: readonly TileMapObject[];\n\n public constructor(options: ObjectLayerOptions) {\n this.id = options.id;\n this.name = options.name ?? '';\n this.class = options.class ?? '';\n this.visible = options.visible ?? true;\n this.opacity = options.opacity ?? 1;\n this.offsetX = options.offsetX ?? 0;\n this.offsetY = options.offsetY ?? 0;\n this.parallaxX = options.parallaxX ?? 1;\n this.parallaxY = options.parallaxY ?? 1;\n this.parallaxScale = options.parallaxScale ?? 1;\n if (!Number.isFinite(this.parallaxScale) || this.parallaxScale <= 0) {\n throw new Error('ObjectLayer parallaxScale must be a positive finite number.');\n }\n this.tintColor = options.tintColor ?? null;\n this.drawOrder = options.drawOrder ?? 'topdown';\n this.properties = options.properties ? Object.freeze({ ...options.properties }) : Object.freeze({});\n this.objects = options.objects ? Object.freeze([...options.objects]) : Object.freeze([]);\n }\n\n /** Objects matching every specified criterion of `filter`. Returns a fresh array. */\n public query(filter: ObjectQuery = {}): TileMapObject[] {\n return this.objects.filter(object => {\n if (filter.name !== undefined && object.name !== filter.name) {\n return false;\n }\n\n if (filter.type !== undefined && object.type !== filter.type) {\n return false;\n }\n\n if (filter.kind !== undefined && object.kind !== filter.kind) {\n return false;\n }\n\n if (filter.property !== undefined) {\n // TilePropertyValue never includes `undefined`, so an `undefined`\n // read is a reliable \"key absent\" signal (equivalent to, but avoids\n // re-indexing after, an `in` check).\n const value = object.properties[filter.property];\n if (value === undefined) {\n return false;\n }\n\n if (filter.value !== undefined && !tilePropertyValueEquals(value, filter.value)) {\n return false;\n }\n }\n\n return true;\n });\n }\n\n /**\n * Objects whose `type` equals `type`, with `properties` narrowed to the\n * schema shape `S[T]`. Returns a fresh array (insertion order).\n *\n * The narrowing is a static convenience only - no runtime validation is\n * performed (see {@link ObjectSchema}). On an unschematised layer this\n * behaves like `query({ type })` with `TileProperties` properties.\n */\n public byType<T extends keyof S & string>(type: T): Array<TypedObject<S, T>> {\n return this.objects.filter(object => object.type === type) as unknown as Array<TypedObject<S, T>>;\n }\n\n /**\n * Objects of the given geometry {@link ObjectKind}, narrowed to that\n * geometry's member type (e.g. `byKind(ObjectKind.Polygon)` yields\n * {@link PolygonObject}s with their `points`). Returns a fresh array.\n */\n public byKind<K extends ObjectKind>(kind: K): Array<Extract<TileMapObject, { kind: K }>> {\n return this.objects.filter(object => object.kind === kind) as Array<Extract<TileMapObject, { kind: K }>>;\n }\n\n /**\n * Objects of `type` (typed as in {@link byType}) that also satisfy\n * `predicate`. A convenience combination of {@link byType} and `Array.filter`\n * that keeps the narrowed `properties` type inside the predicate. Returns a\n * fresh array.\n */\n public where<T extends keyof S & string>(type: T, predicate: (object: TypedObject<S, T>) => boolean): Array<TypedObject<S, T>> {\n return this.byType(type).filter(object => predicate(object));\n }\n\n /** First object with the given id, or undefined. */\n public getObjectById(id: number): TileMapObject | undefined {\n return this.objects.find(object => object.id === id);\n }\n\n /** First object with the given name, or undefined. */\n public getObjectByName(name: string): TileMapObject | undefined {\n return this.objects.find(object => object.name === name);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,aAAa;CACxB,WAAW;CACX,SAAS;CACT,SAAS;CACT,UAAU;CACV,OAAO;CACP,MAAM;CACN,MAAM;AACR;;;;;;AAqNA,MAAM,2BAA2B,UAC/B,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,KAAM,MAA6B,SAAS,iBAAiB;;;;;;;;;;;;;AAclI,MAAM,2BAA2B,GAAsB,MAAkC;CACvF,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,wBAAwB,CAAC,KAAK,wBAAwB,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE;CAChF,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,IAAa,cAAb,MAAg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AO;GAGT,IAAI,OAAO,aAAa,QAAW;IAIjC,MAAM,QAAQ,OAAO,WAAW,OAAO;IACvC,IAAI,UAAU,QACZ,OAAO;IAGT,IAAI,OAAO,UAAU,UAAa,CAAC,wBAAwB,OAAO,OAAO,KAAK,GAC5E,OAAO;GAEX;GAEA,OAAO;EACT,CAAC;CACH;;;;;;;;;CAUA,AAAO,OAAmC,MAAmC;EAC3E,OAAO,KAAK,QAAQ,QAAO,WAAU,OAAO,SAAS,IAAI;CAC3D;;;;;;CAOA,AAAO,OAA6B,MAAqD;EACvF,OAAO,KAAK,QAAQ,QAAO,WAAU,OAAO,SAAS,IAAI;CAC3D;;;;;;;CAQA,AAAO,MAAkC,MAAS,WAA6E;EAC7H,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,QAAO,WAAU,UAAU,MAAM,CAAC;CAC7D;;CAGA,AAAO,cAAc,IAAuC;EAC1D,OAAO,KAAK,QAAQ,MAAK,WAAU,OAAO,OAAO,EAAE;CACrD;;CAGA,AAAO,gBAAgB,MAAyC;EAC9D,OAAO,KAAK,QAAQ,MAAK,WAAU,OAAO,SAAS,IAAI;CACzD;AACF"}
1
+ {"version":3,"file":"ObjectLayer.js","names":[],"sources":["../../src/ObjectLayer.ts"],"sourcesContent":["import type { TileProjection } from './TileProjection';\nimport type { ResolvedTile, TileProperties, TilePropertyObjectRef, TilePropertyValue } from './types';\nimport { TilePropertyKind } from './types';\n\n/**\n * Geometry kinds for a {@link TileMapObject}, as an `as const` value object.\n *\n * Modelled as a frozen string map (not a TS `enum`) so the values stay\n * wire-compatible with the Tiled string serialisation, survive\n * `verbatimModuleSyntax` (no emitted runtime helper), and follow the package\n * convention for enum-like constants. Use the members for ergonomic, typo-safe\n * call sites: `layer.byKind(ObjectKind.Polygon)`.\n * @stable\n */\nexport const ObjectKind = {\n Rectangle: 'rectangle',\n Ellipse: 'ellipse',\n Polygon: 'polygon',\n Polyline: 'polyline',\n Point: 'point',\n Tile: 'tile',\n Text: 'text',\n} as const;\n\n/** Geometry discriminant for a {@link TileMapObject}. */\nexport type ObjectKind = (typeof ObjectKind)[keyof typeof ObjectKind];\n\n/**\n * Geometry discriminant for a {@link TileMapObject}.\n * Structural alias of {@link ObjectKind}; retained so existing code keeps\n * compiling. New code may prefer {@link ObjectKind}.\n */\nexport type TileMapObjectKind = ObjectKind;\n\n/** A point in object-layer space (pixels, relative to the object). */\nexport interface ObjectPoint {\n readonly x: number;\n readonly y: number;\n}\n\n/** Fields shared by every {@link TileMapObject} kind. */\ninterface TileMapObjectBase<P extends TileProperties = TileProperties> {\n /** Source-unique object id. */\n readonly id: number;\n /**\n * Stable string identity assigned by the authoring format, when it has one.\n *\n * LDtk sets it to the entity `iid`, which is globally unique and survives\n * re-ordering, re-export and level moves - the identity to persist in a\n * savegame. Tiled has no such field and leaves this unset; there, {@link id}\n * is the identity and it is unique only within its map.\n */\n readonly sourceId?: string;\n /** Object name (may be empty; not unique). */\n readonly name: string;\n /** Object class/type string (Tiled `type`/`class`; may be empty). */\n readonly type: string;\n /** X of the object origin in layer coordinates; logical pixels when the layer has a projection. */\n readonly x: number;\n /** Y of the object origin in layer coordinates; logical pixels when the layer has a projection. */\n readonly y: number;\n /** Bounding width in px (0 for points). */\n readonly width: number;\n /** Bounding height in px (0 for points). */\n readonly height: number;\n /**\n * Rotation in degrees, clockwise, about `(x, y)` - except on a\n * {@link TileObject}, whose pivot stays at the source format's own anchor and\n * is generally not `(x, y)`. See {@link TileObject} for why.\n */\n readonly rotation: number;\n /** Whether the object is marked visible. */\n readonly visible: boolean;\n /** Immutable custom properties. */\n readonly properties: P;\n /**\n * The raw source-format record this object was parsed from, for the rare\n * case that needs a field this model does not carry. Adapters that keep\n * their parsed document alive set it (`LdtkEntityInstance` for LDtk,\n * `TiledObject` for Tiled); a procedurally built object has none.\n *\n * Reading it ties the code to one source format - prefer the typed fields.\n */\n readonly source?: unknown;\n}\n\n/** An axis-aligned rectangle object spanning `[x, y, width, height]`. */\nexport interface RectangleObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Rectangle;\n}\n\n/** An ellipse inscribed in `[x, y, width, height]`. */\nexport interface EllipseObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Ellipse;\n}\n\n/** A single point at `(x, y)`. */\nexport interface PointObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Point;\n}\n\n/** A closed polygon; `points` are relative to the object origin. */\nexport interface PolygonObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Polygon;\n readonly points: readonly ObjectPoint[];\n}\n\n/** An open polyline; `points` are relative to the object origin. */\nexport interface PolylineObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Polyline;\n readonly points: readonly ObjectPoint[];\n}\n\n/**\n * A tile (GID) object carrying a resolved tile reference.\n *\n * `x`/`y` are the top-left corner of the bounding box, the same convention as\n * every other object kind. Source formats that anchor a tile object elsewhere\n * normalise to the corner on import: Tiled stores the position at the\n * tileset's `objectalignment` point (bottom-left by default on an orthogonal\n * map, bottom-centre on an isometric one) and rotates the tile image about\n * that point, so a non-zero {@link TileMapObjectBase.rotation} on a tile\n * object still pivots about the source anchor rather than about `(x, y)`.\n * Isometric Tiled objects expose this anchor as `rotationOrigin`;\n * `getDisplayObject` projects both the unrotated corner and this pivot.\n *\n * The owning tileset's drawing offset (Tiled `tileoffset`, reachable as\n * `tile.tileset.offsetX`/`offsetY`) is likewise **not** folded into `x`/`y`.\n * Object layers are data-only, so nothing in this package draws a tile object;\n * code that does has to add that offset itself to match how a tile layer\n * places the same tile.\n */\nexport interface TileObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Tile;\n readonly tile: ResolvedTile;\n /** Image rotation pivot in layer coordinates, logical when projected. Adapters may omit it when unavailable. */\n readonly rotationOrigin?: ObjectPoint;\n}\n\n/** Text styling options carried by a {@link TextObject}. */\nexport interface TextStyle {\n /** The text content. */\n readonly text: string;\n /** Text colour as 0xRRGGBB, or `null` if default. */\n readonly color?: number | null;\n /** Font family name. */\n readonly fontFamily?: string;\n /** Font size in pixels. */\n readonly pixelSize?: number;\n /** Bold text. */\n readonly bold?: boolean;\n /** Italic text. */\n readonly italic?: boolean;\n /** Underline text. */\n readonly underline?: boolean;\n /** Strikeout text. */\n readonly strikeout?: boolean;\n /** Wrap text within the object bounds. */\n readonly wrap?: boolean;\n /** Horizontal alignment. */\n readonly halign?: 'left' | 'center' | 'right' | 'justify';\n /** Vertical alignment. */\n readonly valign?: 'top' | 'center' | 'bottom';\n}\n\n/** A text object carrying styled text content within `[x, y, width, height]`. */\nexport interface TextObject<P extends TileProperties = TileProperties> extends TileMapObjectBase<P> {\n readonly kind: typeof ObjectKind.Text;\n readonly text: TextStyle;\n}\n\n/**\n * A format-independent map object. The geometry kind is the discriminant;\n * narrow on `kind` to read shape-specific fields. Template objects are not\n * yet represented.\n *\n * The optional property-shape parameter `P` lets typed accessors\n * (see {@link ObjectLayer.byType}) narrow `properties` to a developer-declared\n * schema. It defaults to the generic {@link TileProperties} bag, so the plain\n * `TileMapObject` form is unchanged.\n * @advanced\n */\nexport type TileMapObject<P extends TileProperties = TileProperties> =\n RectangleObject<P> | EllipseObject<P> | PointObject<P> | PolygonObject<P> | PolylineObject<P> | TileObject<P> | TextObject<P>;\n\n/**\n * A developer-declared mapping from object `type`/class strings to the property\n * shape an object of that type is expected to carry. Supplied as the type\n * parameter to {@link ObjectLayer} to unlock the typed accessors\n * ({@link ObjectLayer.byType}, {@link ObjectLayer.where}).\n *\n * @remarks\n * A schema is a **developer promise, not a runtime guarantee.** Tiled data is\n * untyped at runtime and ExoJS performs no validation against the schema -\n * the property objects are returned exactly as parsed. The schema only refines\n * the static type of `properties` for ergonomic, typo-safe field access. If the\n * source data does not match the declared shape, reads still succeed but the\n * static type is a fiction. Validate at the boundary if you need certainty.\n *\n * @example\n * ```ts\n * const EntityType = { Spawn: 'spawn', Pickup: 'pickup' } as const;\n * interface LevelObjects {\n * [EntityType.Spawn]: { team: 'red' | 'blue' };\n * [EntityType.Pickup]: { item: 'coin' | 'gem'; amount: number };\n * }\n * const entities = map.getObjectLayer<LevelObjects>('Entities');\n * entities.byType(EntityType.Spawn)[0].properties.team; // 'red' | 'blue'\n * ```\n * @stable\n */\nexport type ObjectSchema = Record<string, TileProperties>;\n\n/**\n * A {@link TileMapObject} whose `properties` are narrowed to the schema shape\n * declared for the object `type` `T` in schema `S`.\n * @advanced\n */\nexport type TypedObject<S extends ObjectSchema, T extends keyof S & string> = TileMapObject<S[T]>;\n\n/** Filter for {@link ObjectLayer.query}. Unspecified fields match everything. */\nexport interface ObjectQuery {\n /** Match objects whose `name` equals this. */\n readonly name?: string;\n /** Match objects whose `type`/class equals this. */\n readonly type?: string;\n /** Match objects of this geometry kind. */\n readonly kind?: TileMapObjectKind;\n /** Match objects that carry this property key. */\n readonly property?: string;\n /** When combined with `property`, also require the property value to equal this. */\n readonly value?: TilePropertyValue;\n}\n\n/**\n * Type guard for the {@link TilePropertyObjectRef} variant of\n * {@link TilePropertyValue}.\n * @internal\n */\nconst isTilePropertyObjectRef = (value: TilePropertyValue): value is TilePropertyObjectRef =>\n typeof value === 'object' && value !== null && !Array.isArray(value) && (value as { kind?: unknown }).kind === TilePropertyKind.ObjectRef;\n\n/**\n * Equality used by {@link ObjectLayer.query}'s `value` filter.\n *\n * Scalars and `null` compare with `===`. `objectRef` values compare by `id`\n * alone - the one genuinely common \"find all objects referencing X\" query\n * need - regardless of differing LDtk navigation fields. Every other\n * structured shape (`point`, `tileRef`, arrays, nested property bags) has no\n * obvious value-equality semantics (exact float coordinates? array order?)\n * and only matches when reference-identical; use `query({ property })`\n * (presence-only) for those.\n * @internal\n */\nconst tilePropertyValueEquals = (a: TilePropertyValue, b: TilePropertyValue): boolean => {\n if (a === b) return true;\n if (isTilePropertyObjectRef(a) && isTilePropertyObjectRef(b)) return a.id === b.id;\n return false;\n};\n\n/** Construction options for an {@link ObjectLayer}. */\nexport interface ObjectLayerOptions {\n /** Object geometry uses logical pixels when supplied; display placement is available through getDisplayObject. */\n readonly projection?: TileProjection;\n /** Layer id (unique within the map). */\n readonly id: number;\n /** Layer name. */\n readonly name?: string;\n /** Layer class string. */\n readonly class?: string;\n /** Whether the layer is visible. Default `true`. */\n readonly visible?: boolean;\n /** Layer opacity in `[0, 1]`. Default `1`. */\n readonly opacity?: number;\n /** Layer pixel offset X. Default `0`. */\n readonly offsetX?: number;\n /** Layer pixel offset Y. Default `0`. */\n readonly offsetY?: number;\n /**\n * Parallax scroll factor on the X axis. `1` = full camera speed (normal),\n * `0.5` = half speed (farther away), `0` = stationary. Default `1`.\n */\n readonly parallaxX?: number;\n /**\n * Parallax scroll factor on the Y axis. `1` = full camera speed (normal),\n * `0.5` = half speed (farther away), `0` = stationary. Default `1`.\n */\n readonly parallaxY?: number;\n /** Uniform parallax scale around the layer origin. Default `1`. */\n readonly parallaxScale?: number;\n /**\n * Multiplicative layer tint as a `0xRRGGBB` integer, or `null` for no tint\n * (Tiled `tintcolor`). Default `null`.\n */\n readonly tintColor?: number | null;\n /**\n * Draw order for the objects (Tiled `draworder`): `'topdown'` (sorted by `y`)\n * or `'index'` (source order). Informational; objects are stored as given.\n * Default `'topdown'`.\n */\n readonly drawOrder?: 'topdown' | 'index';\n /** The objects in this layer. */\n readonly objects?: readonly TileMapObject[];\n /** Layer-level properties (copied and frozen). */\n readonly properties?: TileProperties;\n}\n\n/**\n * A data-only layer of {@link TileMapObject}s - spawn points, trigger zones,\n * collision regions, markers. Object layers are not rendered by the tile\n * renderer; they are parsed and exposed for gameplay use (e.g. building physics\n * colliders, placing entities).\n *\n * The presentation fields the source format attaches to a layer -\n * {@link visible}, {@link opacity}, {@link offsetX}/{@link offsetY},\n * {@link parallaxX}/{@link parallaxY}, {@link parallaxScale}, and\n * {@link tintColor} - are carried\n * through in full, with any enclosing group layers' contribution already\n * folded in, so an object layer describes the same placement and shading its\n * neighbouring tile and image layers do. Nothing here acts on them: code that\n * draws these objects itself is what applies them.\n *\n * Query with {@link query} (untyped, fully back-compatible) or, when an\n * {@link ObjectSchema} type argument `S` is supplied, with the typed accessors\n * {@link byType}, {@link byKind}, and {@link where} - these narrow `properties`\n * to the developer-declared shape. The schema is **opt-in**: the default type\n * parameter reproduces the original untyped behaviour, so\n * `new ObjectLayer(options)` and `map.getObjectLayer('x')` are unchanged.\n *\n * @remarks\n * A schema is a developer promise, not a runtime guarantee - Tiled data is\n * untyped at runtime and ExoJS performs no validation. See {@link ObjectSchema}.\n *\n * @typeParam S - Optional {@link ObjectSchema} mapping object `type` strings to\n * their property shapes. Defaults to a generic schema (every type maps to the\n * loose {@link TileProperties} bag).\n *\n * @advanced\n */\nexport class ObjectLayer<S extends ObjectSchema = ObjectSchema> {\n /** Projection of the logical object geometry, or undefined for ordinary display-space objects. */\n public readonly projection: TileProjection | undefined;\n /** Layer-kind discriminant (distinguishes object layers from tile layers). */\n public readonly kind = 'object' as const;\n\n /** Layer id (unique within the map). */\n public readonly id: number;\n /** Layer name. */\n public readonly name: string;\n /** Layer class string. */\n public readonly class: string;\n /** Whether the layer is visible. */\n public readonly visible: boolean;\n /** Layer opacity in `[0, 1]`. */\n public readonly opacity: number;\n /** Layer pixel offset X. */\n public readonly offsetX: number;\n /** Layer pixel offset Y. */\n public readonly offsetY: number;\n /**\n * Parallax scroll factor on the X axis - the same quantity\n * {@link import('./TileLayer').TileLayer.parallaxX} carries, so an object\n * layer authored beside a tile layer in the same parallax group reports the\n * same factor. `1` = full camera speed, `0.5` = half speed, `0` =\n * stationary. Nothing in this package applies it: object layers are\n * data-only, so placing an object relative to the camera is the consumer's\n * job (see {@link ObjectLayer}).\n */\n public readonly parallaxX: number;\n /** Parallax scroll factor on the Y axis. See {@link ObjectLayer.parallaxX}. */\n public readonly parallaxY: number;\n /** Uniform scale applied around the layer origin by consumers that render this data-only layer. */\n public readonly parallaxScale: number;\n /**\n * Multiplicative layer tint as `0xRRGGBB`, or `null` for no tint. Carried\n * from the source map (including the accumulated tint of any enclosing group\n * layers) for code that draws these objects itself; like\n * {@link ObjectLayer.parallaxX}, nothing in this package applies it.\n */\n public readonly tintColor: number | null;\n /** Draw order for the objects (Tiled `draworder`). Informational. */\n public readonly drawOrder: 'topdown' | 'index';\n /** Immutable layer-level properties. */\n public readonly properties: TileProperties;\n /** The objects in this layer (insertion order). */\n public readonly objects: readonly TileMapObject[];\n\n public constructor(options: ObjectLayerOptions) {\n this.id = options.id;\n this.projection = options.projection;\n this.name = options.name ?? '';\n this.class = options.class ?? '';\n this.visible = options.visible ?? true;\n this.opacity = options.opacity ?? 1;\n this.offsetX = options.offsetX ?? 0;\n this.offsetY = options.offsetY ?? 0;\n this.parallaxX = options.parallaxX ?? 1;\n this.parallaxY = options.parallaxY ?? 1;\n this.parallaxScale = options.parallaxScale ?? 1;\n if (!Number.isFinite(this.parallaxScale) || this.parallaxScale <= 0) {\n throw new Error('ObjectLayer parallaxScale must be a positive finite number.');\n }\n this.tintColor = options.tintColor ?? null;\n this.drawOrder = options.drawOrder ?? 'topdown';\n this.properties = options.properties ? Object.freeze({ ...options.properties }) : Object.freeze({});\n this.objects = options.objects ? Object.freeze([...options.objects]) : Object.freeze([]);\n }\n\n /**\n * Returns display-space geometry including the layer offset. Isometric\n * rectangles become polygons; ellipses retain their exact affine shape.\n * Tile/text dimensions remain display pixels. Parallax and scene transforms\n * are applied by the consumer, after this conversion.\n */\n public getDisplayObject(object: TileMapObject): TileMapObject {\n const projected = this.projection?.projectObject(object) ?? object;\n const position = { x: projected.x + this.offsetX, y: projected.y + this.offsetY };\n if (projected.kind === 'tile' && projected.rotationOrigin) {\n return { ...projected, ...position, rotationOrigin: { x: projected.rotationOrigin.x + this.offsetX, y: projected.rotationOrigin.y + this.offsetY } };\n }\n return { ...projected, ...position };\n }\n\n /** Objects matching every specified criterion of `filter`. Returns a fresh array. */\n public query(filter: ObjectQuery = {}): TileMapObject[] {\n return this.objects.filter(object => {\n if (filter.name !== undefined && object.name !== filter.name) {\n return false;\n }\n\n if (filter.type !== undefined && object.type !== filter.type) {\n return false;\n }\n\n if (filter.kind !== undefined && object.kind !== filter.kind) {\n return false;\n }\n\n if (filter.property !== undefined) {\n // TilePropertyValue never includes `undefined`, so an `undefined`\n // read is a reliable \"key absent\" signal (equivalent to, but avoids\n // re-indexing after, an `in` check).\n const value = object.properties[filter.property];\n if (value === undefined) {\n return false;\n }\n\n if (filter.value !== undefined && !tilePropertyValueEquals(value, filter.value)) {\n return false;\n }\n }\n\n return true;\n });\n }\n\n /**\n * Objects whose `type` equals `type`, with `properties` narrowed to the\n * schema shape `S[T]`. Returns a fresh array (insertion order).\n *\n * The narrowing is a static convenience only - no runtime validation is\n * performed (see {@link ObjectSchema}). On an unschematised layer this\n * behaves like `query({ type })` with `TileProperties` properties.\n */\n public byType<T extends keyof S & string>(type: T): Array<TypedObject<S, T>> {\n return this.objects.filter(object => object.type === type) as unknown as Array<TypedObject<S, T>>;\n }\n\n /**\n * Objects of the given geometry {@link ObjectKind}, narrowed to that\n * geometry's member type (e.g. `byKind(ObjectKind.Polygon)` yields\n * {@link PolygonObject}s with their `points`). Returns a fresh array.\n */\n public byKind<K extends ObjectKind>(kind: K): Array<Extract<TileMapObject, { kind: K }>> {\n return this.objects.filter(object => object.kind === kind) as Array<Extract<TileMapObject, { kind: K }>>;\n }\n\n /**\n * Objects of `type` (typed as in {@link byType}) that also satisfy\n * `predicate`. A convenience combination of {@link byType} and `Array.filter`\n * that keeps the narrowed `properties` type inside the predicate. Returns a\n * fresh array.\n */\n public where<T extends keyof S & string>(type: T, predicate: (object: TypedObject<S, T>) => boolean): Array<TypedObject<S, T>> {\n return this.byType(type).filter(object => predicate(object));\n }\n\n /** First object with the given id, or undefined. */\n public getObjectById(id: number): TileMapObject | undefined {\n return this.objects.find(object => object.id === id);\n }\n\n /** First object with the given name, or undefined. */\n public getObjectByName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QAAQ,QAAO,WAAU,OAAO,SAAS,IAAI;CAC3D;;;;;;CAOA,AAAO,OAA6B,MAAqD;EACvF,OAAO,KAAK,QAAQ,QAAO,WAAU,OAAO,SAAS,IAAI;CAC3D;;;;;;;CAQA,AAAO,MAAkC,MAAS,WAA6E;EAC7H,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,QAAO,WAAU,UAAU,MAAM,CAAC;CAC7D;;CAGA,AAAO,cAAc,IAAuC;EAC1D,OAAO,KAAK,QAAQ,MAAK,WAAU,OAAO,OAAO,EAAE;CACrD;;CAGA,AAAO,gBAAgB,MAAyC;EAC9D,OAAO,KAAK,QAAQ,MAAK,WAAU,OAAO,SAAS,IAAI;CACzD;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"SampledChunkSource.d.ts","sourceRoot":"","sources":["../../src/SampledChunkSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACvC;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;CAC5E;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,SAAS,EAAE,SAAS,yBAAyB,KAAG,WAiC/F,CAAC"}
1
+ {"version":3,"file":"SampledChunkSource.d.ts","sourceRoot":"","sources":["../../src/SampledChunkSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,eAAe,C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3,"file":"TileAnimator.d.ts","sourceRoot":"","sources":["../../src/TileAnimator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAmB7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuB;IAC/C,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,UAAU,CAAK;IAEvB;;;OAGG;IACH,YAAmB,MAAM,EAAE,SAAS,GAAG,SAAS,SAAS,EAAE,EAG1D;IAED,uEAAuE;IACvE,IAAW,iBAAiB,IAAI,MAAM,CAErC;IAED,6EAA6E;IAC7E,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;;;;OAMG;IACI,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAwBxC;IAED;;;OAGG;IACI,KAAK,IAAI,IAAI,CAcnB;IAED;;;;OAIG;IACI,MAAM,IAAI,IAAI,CAGpB;IAED,sEAAsE;IAC/D,OAAO,IAAI,IAAI,CAGrB;IAED,8EAA8E;IAC9E,OAAO,CAAC,KAAK;CAqDd"}
@@ -1 +1 @@
1
- {"version":3,"file":"TileChunk.d.ts","sourceRoot":"","sources":["../../src/TileChunk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH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;IAC3D,OAAO,CAAC,MAAM;IAId;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAa3B,kBAAkB;IACX,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAGlD;IAED,kBAAkB;IAClB,IAAW,KAAK,IAAI,OAAO,CAK1B;IAED,kBAAkB;IAClB,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,kBAAkB;IACX,UAAU,IAAI,WAAW,CAE/B;IAqGD,OAAO,CAAC,YAAY;CAMrB"}
@@ -1,13 +1,15 @@
1
1
  import { buildChunkPages } from "./chunkGeometry.js";
2
2
  import { TileChunk } from "./TileChunk.js";
3
+ import { TileProjection } from "./TileProjection.js";
3
4
  import { Drawable } from "@codexo/exojs/renderer-sdk";
4
5
 
5
6
  //#region src/TileChunkNode.ts
6
7
  /**
7
8
  * A single renderable tile chunk. One `TileChunkNode` is a {@link Drawable}
8
9
  * that owns the batched quad geometry for exactly one {@link ReadonlyTileChunk}
9
- * of one {@link import('./TileLayer').TileLayer}, positioned at the chunk's
10
- * pixel origin within the owning {@link TileLayerNode}.
10
+ * of one {@link import('./TileLayer').TileLayer}. Orthogonal nodes use the
11
+ * chunk's pixel origin; isometric nodes draw one diagonal slice and share
12
+ * the projection origin to keep pixel snapping independent of chunk layout.
11
13
  *
12
14
  * Geometry is built lazily and cached against the source chunk's `revision`:
13
15
  * the renderer reads {@link TileChunkNode.pages} on each visible frame, but a
@@ -27,8 +29,12 @@ var TileChunkNode = class extends Drawable {
27
29
  _tilesets;
28
30
  _tileWidth;
29
31
  _tileHeight;
30
- _pixelWidth;
31
- _pixelHeight;
32
+ _projection;
33
+ _geometryX;
34
+ _geometryY;
35
+ diagonal;
36
+ depth;
37
+ firstColumn;
32
38
  _pages = [];
33
39
  _builtRevision = -1;
34
40
  /**
@@ -53,15 +59,26 @@ var TileChunkNode = class extends Drawable {
53
59
  * `cx * chunkWidthTiles`.
54
60
  * @param chunkHeightTiles The layer's (unclamped) chunk height in tiles.
55
61
  */
56
- constructor(chunk, tilesets, tileWidth, tileHeight, chunkWidthTiles, chunkHeightTiles) {
62
+ constructor(chunk, tilesets, tileWidth, tileHeight, chunkWidthTiles, chunkHeightTiles, projection = new TileProjection({
63
+ tileWidth,
64
+ tileHeight
65
+ }), diagonal) {
57
66
  super();
58
67
  this._chunk = chunk;
59
68
  this._tilesets = tilesets;
60
69
  this._tileWidth = tileWidth;
61
70
  this._tileHeight = tileHeight;
62
- this._pixelWidth = chunk.width * tileWidth;
63
- this._pixelHeight = chunk.height * tileHeight;
64
- this.setPosition(chunk.cx * chunkWidthTiles * tileWidth, chunk.cy * chunkHeightTiles * tileHeight);
71
+ this._projection = projection;
72
+ this.diagonal = diagonal;
73
+ const tx = chunk.cx * chunkWidthTiles;
74
+ const ty = chunk.cy * chunkHeightTiles;
75
+ this.depth = tx + ty + (diagonal ?? 0);
76
+ this.firstColumn = tx + Math.max(0, (diagonal ?? 0) - chunk.height + 1);
77
+ const position = projection.tileToPixel(tx, ty);
78
+ const iso = projection.orientation === "isometric";
79
+ this._geometryX = iso ? position.x - projection.originX : 0;
80
+ this._geometryY = iso ? position.y - projection.originY : 0;
81
+ this.setPosition(iso ? projection.originX : position.x, iso ? projection.originY : position.y);
65
82
  if (chunk instanceof TileChunk) chunk._addDirtyListener(this._onChunkDirty);
66
83
  }
67
84
  /** The signed chunk coordinates this node renders. */
@@ -78,7 +95,7 @@ var TileChunkNode = class extends Drawable {
78
95
  */
79
96
  get pages() {
80
97
  if (this._builtRevision !== this._chunk.revision) {
81
- this._pages = buildChunkPages(this._chunk, this._tilesets, this._tileWidth, this._tileHeight);
98
+ this._pages = buildChunkPages(this._chunk, this._tilesets, this._tileWidth, this._tileHeight, this._projection, this.diagonal, this._geometryX, this._geometryY);
82
99
  this._builtRevision = this._chunk.revision;
83
100
  }
84
101
  return this._pages;
@@ -93,7 +110,27 @@ var TileChunkNode = class extends Drawable {
93
110
  * would re-dirty the node on every read.
94
111
  */
95
112
  getLocalBounds() {
96
- return this._localBounds.set(0, 0, this._pixelWidth, this._pixelHeight);
113
+ if (!(this._projection.orientation === "isometric")) return this._localBounds.set(0, 0, this._chunk.width * this._tileWidth, this._chunk.height * this._tileHeight);
114
+ const d = this.diagonal;
115
+ const minX = d === void 0 ? 0 : Math.max(0, d - this._chunk.height + 1);
116
+ const maxX = d === void 0 ? this._chunk.width - 1 : Math.min(this._chunk.width - 1, d);
117
+ const minY = d === void 0 ? 0 : d - maxX;
118
+ const maxY = d === void 0 ? this._chunk.height - 1 : d - minX;
119
+ let left = (minX - maxY - 1) * this._tileWidth / 2;
120
+ let top = (minX + maxY) * this._tileHeight / 2;
121
+ let right = (maxX - minY + 1) * this._tileWidth / 2;
122
+ let bottom = (maxX + minY) * this._tileHeight / 2 + this._tileHeight;
123
+ const baseLeft = left;
124
+ const baseTop = top;
125
+ const baseRight = right;
126
+ const baseBottom = bottom;
127
+ for (const tileset of this._tilesets) {
128
+ left = Math.min(left, baseLeft + tileset.offsetX);
129
+ top = Math.min(top, baseTop + this._tileHeight - tileset.tileHeight + tileset.offsetY);
130
+ right = Math.max(right, baseRight + tileset.tileWidth - this._tileWidth + tileset.offsetX);
131
+ bottom = Math.max(bottom, baseBottom + tileset.offsetY);
132
+ }
133
+ return this._localBounds.set(left + this._geometryX, top + this._geometryY, right - left, bottom - top);
97
134
  }
98
135
  destroy() {
99
136
  if (this._chunk instanceof TileChunk) this._chunk._removeDirtyListener(this._onChunkDirty);
@@ -1 +1 @@
1
- {"version":3,"file":"TileChunkNode.js","names":[],"sources":["../../src/TileChunkNode.ts"],"sourcesContent":["import type { ReadonlyRectangle } from '@codexo/exojs';\nimport { Drawable } from '@codexo/exojs/renderer-sdk';\n\nimport type { ChunkPage } from './chunkGeometry';\nimport { buildChunkPages } from './chunkGeometry';\nimport type { ReadonlyTileChunk } from './TileChunk';\nimport { TileChunk } from './TileChunk';\nimport type { TileSet } from './TileSet';\n\n/**\n * A single renderable tile chunk. One `TileChunkNode` is a {@link Drawable}\n * that owns the batched quad geometry for exactly one {@link ReadonlyTileChunk}\n * of one {@link import('./TileLayer').TileLayer}, positioned at the chunk's\n * pixel origin within the owning {@link TileLayerNode}.\n *\n * Geometry is built lazily and cached against the source chunk's `revision`:\n * the renderer reads {@link TileChunkNode.pages} on each visible frame, but a\n * rebuild only happens when the underlying chunk actually changed. Off-screen\n * chunks are culled by their accurate {@link getLocalBounds} before `render`\n * is ever called, so a camera pan rebuilds nothing.\n *\n * The node references - but never owns - the runtime chunk, tilesets, and\n * tileset textures. Destroying it releases only its cached CPU geometry; the\n * `TileMap`/`TileLayer` data and Loader-owned textures are untouched.\n *\n * @internal Package-internal render node; the renderer is registered for this\n * class. Applications use {@link TileMapNode} / {@link TileLayerNode}.\n */\nexport class TileChunkNode extends Drawable {\n private readonly _chunk: ReadonlyTileChunk;\n private readonly _tilesets: readonly TileSet[];\n private readonly _tileWidth: number;\n private readonly _tileHeight: number;\n private readonly _pixelWidth: number;\n private readonly _pixelHeight: number;\n\n private _pages: ChunkPage[] = [];\n private _builtRevision = -1;\n\n /**\n * Bound once so `TileChunk._addDirtyListener`/`_removeDirtyListener` add and\n * remove the SAME function reference. Pushes the chunk's revision bump onto\n * this node's own content revision (see `TileChunk._dirtyListeners`) so a\n * `RetainedContainer` ancestor - which skips walking a content-clean\n * subtree entirely - observes the mutation and re-collects instead of\n * replaying stale cached geometry.\n */\n private readonly _onChunkDirty = (): void => {\n this.invalidateContent();\n };\n\n /**\n * @param chunk The readonly chunk this node renders.\n * @param tilesets The owning layer's tileset array.\n * @param tileWidth Map/layer tile cell width in pixels.\n * @param tileHeight Map/layer tile cell height in pixels.\n * @param chunkWidthTiles The layer's (unclamped) chunk width in tiles, used\n * to compute the chunk's pixel origin. Edge chunks\n * report a smaller `chunk.width`, but always start at\n * `cx * chunkWidthTiles`.\n * @param chunkHeightTiles The layer's (unclamped) chunk height in tiles.\n */\n public constructor(\n chunk: ReadonlyTileChunk,\n tilesets: readonly TileSet[],\n tileWidth: number,\n tileHeight: number,\n chunkWidthTiles: number,\n chunkHeightTiles: number,\n ) {\n super();\n\n this._chunk = chunk;\n this._tilesets = tilesets;\n this._tileWidth = tileWidth;\n this._tileHeight = tileHeight;\n this._pixelWidth = chunk.width * tileWidth;\n this._pixelHeight = chunk.height * tileHeight;\n\n this.setPosition(chunk.cx * chunkWidthTiles * tileWidth, chunk.cy * chunkHeightTiles * tileHeight);\n\n // `loadedChunks()` always yields the concrete `TileChunk` behind the\n // readonly view (see TileLayer); the guard is defensive only.\n if (chunk instanceof TileChunk) {\n chunk._addDirtyListener(this._onChunkDirty);\n }\n }\n\n /** The signed chunk coordinates this node renders. */\n public get chunkX(): number {\n return this._chunk.cx;\n }\n\n public get chunkY(): number {\n return this._chunk.cy;\n }\n\n /**\n * The revision-cached per-tileset page geometry. Rebuilt only when the source\n * chunk's `revision` advances; otherwise the same arrays are returned.\n * @internal Read by the per-backend tile chunk renderer.\n */\n public get pages(): readonly ChunkPage[] {\n if (this._builtRevision !== this._chunk.revision) {\n this._pages = buildChunkPages(this._chunk, this._tilesets, this._tileWidth, this._tileHeight);\n this._builtRevision = this._chunk.revision;\n }\n\n return this._pages;\n }\n\n /** `true` when the chunk has no drawable tiles (no geometry, no draw calls). */\n public get isEmpty(): boolean {\n return this.pages.length === 0;\n }\n\n /**\n * Recomputed lazily on read, so it writes `_localBounds` directly rather than\n * going through `setLocalBounds`: an invalidating write inside a getter\n * would re-dirty the node on every read.\n */\n public override getLocalBounds(): ReadonlyRectangle {\n return this._localBounds.set(0, 0, this._pixelWidth, this._pixelHeight);\n }\n\n public override destroy(): void {\n if (this._chunk instanceof TileChunk) {\n this._chunk._removeDirtyListener(this._onChunkDirty);\n }\n\n this._pages = [];\n this._builtRevision = -1;\n\n super.destroy();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,gBAAb,cAAmC,SAAS;CAC1C,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,AAAQ,SAAsB,CAAC;CAC/B,AAAQ,iBAAiB;;;;;;;;;CAUzB,AAAiB,sBAA4B;EAC3C,KAAK,kBAAkB;CACzB;;;;;;;;;;;;CAaA,AAAO,YACL,OACA,UACA,WACA,YACA,iBACA,kBACA;EACA,MAAM;EAEN,KAAK,SAAS;EACd,KAAK,YAAY;EACjB,KAAK,aAAa;EAClB,KAAK,cAAc;EACnB,KAAK,cAAc,MAAM,QAAQ;EACjC,KAAK,eAAe,MAAM,SAAS;EAEnC,KAAK,YAAY,MAAM,KAAK,kBAAkB,WAAW,MAAM,KAAK,mBAAmB,UAAU;EAIjG,IAAI,iBAAiB,WACnB,MAAM,kBAAkB,KAAK,aAAa;CAE9C;;CAGA,IAAW,SAAiB;EAC1B,OAAO,KAAK,OAAO;CACrB;CAEA,IAAW,SAAiB;EAC1B,OAAO,KAAK,OAAO;CACrB;;;;;;CAOA,IAAW,QAA8B;EACvC,IAAI,KAAK,mBAAmB,KAAK,OAAO,UAAU;GAChD,KAAK,SAAS,gBAAgB,KAAK,QAAQ,KAAK,WAAW,KAAK,YAAY,KAAK,WAAW;GAC5F,KAAK,iBAAiB,KAAK,OAAO;EACpC;EAEA,OAAO,KAAK;CACd;;CAGA,IAAW,UAAmB;EAC5B,OAAO,KAAK,MAAM,WAAW;CAC/B;;;;;;CAOA,AAAgB,iBAAoC;EAClD,OAAO,KAAK,aAAa,IAAI,GAAG,GAAG,KAAK,aAAa,KAAK,YAAY;CACxE;CAEA,AAAgB,UAAgB;EAC9B,IAAI,KAAK,kBAAkB,WACzB,KAAK,OAAO,qBAAqB,KAAK,aAAa;EAGrD,KAAK,SAAS,CAAC;EACf,KAAK,iBAAiB;EAEtB,MAAM,QAAQ;CAChB;AACF"}
1
+ {"version":3,"file":"TileChunkNode.js","names":[],"sources":["../../src/TileChunkNode.ts"],"sourcesContent":["import type { ReadonlyRectangle } from '@codexo/exojs';\nimport { Drawable } from '@codexo/exojs/renderer-sdk';\n\nimport type { ChunkPage } from './chunkGeometry';\nimport { buildChunkPages } from './chunkGeometry';\nimport type { ReadonlyTileChunk } from './TileChunk';\nimport { TileChunk } from './TileChunk';\nimport { TileProjection } from './TileProjection';\nimport type { TileSet } from './TileSet';\n\n/**\n * A single renderable tile chunk. One `TileChunkNode` is a {@link Drawable}\n * that owns the batched quad geometry for exactly one {@link ReadonlyTileChunk}\n * of one {@link import('./TileLayer').TileLayer}. Orthogonal nodes use the\n * chunk's pixel origin; isometric nodes draw one diagonal slice and share\n * the projection origin to keep pixel snapping independent of chunk layout.\n *\n * Geometry is built lazily and cached against the source chunk's `revision`:\n * the renderer reads {@link TileChunkNode.pages} on each visible frame, but a\n * rebuild only happens when the underlying chunk actually changed. Off-screen\n * chunks are culled by their accurate {@link getLocalBounds} before `render`\n * is ever called, so a camera pan rebuilds nothing.\n *\n * The node references - but never owns - the runtime chunk, tilesets, and\n * tileset textures. Destroying it releases only its cached CPU geometry; the\n * `TileMap`/`TileLayer` data and Loader-owned textures are untouched.\n *\n * @internal Package-internal render node; the renderer is registered for this\n * class. Applications use {@link TileMapNode} / {@link TileLayerNode}.\n */\nexport class TileChunkNode extends Drawable {\n private readonly _chunk: ReadonlyTileChunk;\n private readonly _tilesets: readonly TileSet[];\n private readonly _tileWidth: number;\n private readonly _tileHeight: number;\n private readonly _projection: TileProjection;\n private readonly _geometryX: number;\n private readonly _geometryY: number;\n public readonly diagonal: number | undefined;\n public readonly depth: number;\n public readonly firstColumn: number;\n\n private _pages: ChunkPage[] = [];\n private _builtRevision = -1;\n\n /**\n * Bound once so `TileChunk._addDirtyListener`/`_removeDirtyListener` add and\n * remove the SAME function reference. Pushes the chunk's revision bump onto\n * this node's own content revision (see `TileChunk._dirtyListeners`) so a\n * `RetainedContainer` ancestor - which skips walking a content-clean\n * subtree entirely - observes the mutation and re-collects instead of\n * replaying stale cached geometry.\n */\n private readonly _onChunkDirty = (): void => {\n this.invalidateContent();\n };\n\n /**\n * @param chunk The readonly chunk this node renders.\n * @param tilesets The owning layer's tileset array.\n * @param tileWidth Map/layer tile cell width in pixels.\n * @param tileHeight Map/layer tile cell height in pixels.\n * @param chunkWidthTiles The layer's (unclamped) chunk width in tiles, used\n * to compute the chunk's pixel origin. Edge chunks\n * report a smaller `chunk.width`, but always start at\n * `cx * chunkWidthTiles`.\n * @param chunkHeightTiles The layer's (unclamped) chunk height in tiles.\n */\n public constructor(\n chunk: ReadonlyTileChunk,\n tilesets: readonly TileSet[],\n tileWidth: number,\n tileHeight: number,\n chunkWidthTiles: number,\n chunkHeightTiles: number,\n projection = new TileProjection({ tileWidth, tileHeight }),\n diagonal?: number,\n ) {\n super();\n\n this._chunk = chunk;\n this._tilesets = tilesets;\n this._tileWidth = tileWidth;\n this._tileHeight = tileHeight;\n this._projection = projection;\n this.diagonal = diagonal;\n const tx = chunk.cx * chunkWidthTiles;\n const ty = chunk.cy * chunkHeightTiles;\n this.depth = tx + ty + (diagonal ?? 0);\n this.firstColumn = tx + Math.max(0, (diagonal ?? 0) - chunk.height + 1);\n const position = projection.tileToPixel(tx, ty);\n const iso = projection.orientation === 'isometric';\n this._geometryX = iso ? position.x - projection.originX : 0;\n this._geometryY = iso ? position.y - projection.originY : 0;\n // Shared origin keeps pixel snapping coherent when projected pitches are fractional.\n this.setPosition(iso ? projection.originX : position.x, iso ? projection.originY : position.y);\n\n // `loadedChunks()` always yields the concrete `TileChunk` behind the\n // readonly view (see TileLayer); the guard is defensive only.\n if (chunk instanceof TileChunk) {\n chunk._addDirtyListener(this._onChunkDirty);\n }\n }\n\n /** The signed chunk coordinates this node renders. */\n public get chunkX(): number {\n return this._chunk.cx;\n }\n\n public get chunkY(): number {\n return this._chunk.cy;\n }\n\n /**\n * The revision-cached per-tileset page geometry. Rebuilt only when the source\n * chunk's `revision` advances; otherwise the same arrays are returned.\n * @internal Read by the per-backend tile chunk renderer.\n */\n public get pages(): readonly ChunkPage[] {\n if (this._builtRevision !== this._chunk.revision) {\n this._pages = buildChunkPages(\n this._chunk,\n this._tilesets,\n this._tileWidth,\n this._tileHeight,\n this._projection,\n this.diagonal,\n this._geometryX,\n this._geometryY,\n );\n this._builtRevision = this._chunk.revision;\n }\n\n return this._pages;\n }\n\n /** `true` when the chunk has no drawable tiles (no geometry, no draw calls). */\n public get isEmpty(): boolean {\n return this.pages.length === 0;\n }\n\n /**\n * Recomputed lazily on read, so it writes `_localBounds` directly rather than\n * going through `setLocalBounds`: an invalidating write inside a getter\n * would re-dirty the node on every read.\n */\n public override getLocalBounds(): ReadonlyRectangle {\n const iso = this._projection.orientation === 'isometric';\n if (!iso) return this._localBounds.set(0, 0, this._chunk.width * this._tileWidth, this._chunk.height * this._tileHeight);\n const d = this.diagonal;\n const minX = d === undefined ? 0 : Math.max(0, d - this._chunk.height + 1);\n const maxX = d === undefined ? this._chunk.width - 1 : Math.min(this._chunk.width - 1, d);\n const minY = d === undefined ? 0 : d - maxX;\n const maxY = d === undefined ? this._chunk.height - 1 : d - minX;\n let left = ((minX - maxY - 1) * this._tileWidth) / 2;\n let top = ((minX + maxY) * this._tileHeight) / 2;\n let right = ((maxX - minY + 1) * this._tileWidth) / 2;\n let bottom = ((maxX + minY) * this._tileHeight) / 2 + this._tileHeight;\n const baseLeft = left;\n const baseTop = top;\n const baseRight = right;\n const baseBottom = bottom;\n for (const tileset of this._tilesets) {\n left = Math.min(left, baseLeft + tileset.offsetX);\n top = Math.min(top, baseTop + this._tileHeight - tileset.tileHeight + tileset.offsetY);\n right = Math.max(right, baseRight + tileset.tileWidth - this._tileWidth + tileset.offsetX);\n bottom = Math.max(bottom, baseBottom + tileset.offsetY);\n }\n return this._localBounds.set(left + this._geometryX, top + this._geometryY, right - left, bottom - top);\n }\n\n public override destroy(): void {\n if (this._chunk instanceof TileChunk) {\n this._chunk._removeDirtyListener(this._onChunkDirty);\n }\n\n this._pages = [];\n this._builtRevision = -1;\n\n super.destroy();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;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a,IAAI,OAAO,KAAK,YAAY,MAAM,KAAK,YAAY,QAAQ,MAAM,SAAS,GAAG;CACxG;CAEA,AAAgB,UAAgB;EAC9B,IAAI,KAAK,kBAAkB,WACzB,KAAK,OAAO,qBAAqB,KAAK,aAAa;EAGrD,KAAK,SAAS,CAAC;EACf,KAAK,iBAAiB;EAEtB,MAAM,QAAQ;CAChB;AACF"}
@@ -1,4 +1,5 @@
1
1
  import type { ReadonlyTileChunk } from './TileChunk';
2
+ import { TileProjection } from './TileProjection';
2
3
  import type { TileSet } from './TileSet';
3
4
  import type { TileProperties } from './types';
4
5
  import type { PackedTile, ResolvedTile } from './types';
@@ -7,6 +8,8 @@ import type { PackedTile, ResolvedTile } from './types';
7
8
  * @advanced
8
9
  */
9
10
  export interface TileLayerOptions {
11
+ /** Shared projection; defaults to an orthogonal grid of the supplied tile size. */
12
+ readonly projection?: TileProjection;
10
13
  /** Stable layer ID (unique within the map). */
11
14
  readonly id: number;
12
15
  /** Display name (need not be unique). */
@@ -92,6 +95,7 @@ export interface ChunkRange {
92
95
  * @advanced
93
96
  */
94
97
  export declare class TileLayer {
98
+ readonly projection: TileProjection;
95
99
  /** Stable unique ID within the map. */
96
100
  readonly id: number;
97
101
  /** Display name (may not be unique). */
@@ -232,9 +236,14 @@ export declare class TileLayer {
232
236
  ty: number;
233
237
  tile: ResolvedTile;
234
238
  }>;
239
+ /** Display layer translation expressed as a logical simulation-space vector. */
240
+ get logicalOffset(): {
241
+ x: number;
242
+ y: number;
243
+ };
235
244
  /**
236
- * Convert a tile coordinate to the pixel position of its top-left corner
237
- * in the layer's local space.
245
+ * Convert a grid vertex to display pixels (the top diamond vertex for isometric cells)
246
+ * including the layer's display offset.
238
247
  * @advanced
239
248
  */
240
249
  tileToPixel(tx: number, ty: number): {
@@ -1 +1 @@
1
- {"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["../../src/TileLayer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,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