API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classTiledMap

@codexo/exojs-tiled / tiled / stable

A parsed and validated Tiled map (`.tmj`). `TiledMap` represents the parsed Tiled source format. `TileMap` is the format-independent ExoJS runtime map used for rendering, queries, and mutation. Construction validates that tilesets cover a non-overlapping, duplicate-free range of global tile ids, and that every GID referenced by layers (tile layer cells, infinite-map chunks, and tile object `gid`s) falls within one of those ranges. Both checks throw TiledFormatError on failure.

14
props
5
methods
0
events
Import
import { TiledMap } from '@codexo/exojs-tiled'

A parsed and validated Tiled map (`.tmj`).

`TiledMap` represents the parsed Tiled source format. `TileMap` is the format-independent ExoJS runtime map used for rendering, queries, and mutation.

Construction validates that tilesets cover a non-overlapping, duplicate-free range of global tile ids, and that every GID referenced by layers (tile layer cells, infinite-map chunks, and tile object `gid`s) falls within one of those ranges. Both checks throw TiledFormatError on failure.

Constructors1
Methods5
destroy(): void
Releases this map's reference to its parsed source. Tileset textures are Loader-owned and may be shared with other maps; this does NOT destroy them.
Returns the tileset that owns gid, or undefined if gid is 0 (the empty-cell sentinel) or is not covered by any tileset. Flip/rotation flag bits are masked off before the range lookup, so the raw GID values found in TiledTileLayer.data/chunks and TiledObject.gid can be passed directly.
The ChunkSource built for the chunked tile layer with the given Tiled layer id, as a side effect of the most recent toTileMap call. Returns undefined if toTileMap() hasn't been called yet, if layerId doesn't name a tile layer, or if that layer is finite (data-based) rather than chunked (infinite-map chunks-based). Call toTileMap before calling this - it is what builds the providers this method reads from.
Convert this parsed Tiled source model into a format-independent runtime TileMap from @codexo/exojs-tilemap. Only orthogonal maps with atlas tilesets are supported. A non-orthogonal map, a collection-of-images tileset, or a tileset with no image at all throws TiledFormatError rather than silently producing wrong (misplaced) or empty geometry. Tile layers become renderable TileLayers, object groups become data-only ObjectLayers, and image layers become data-only ImageLayers; group layer children are flattened in document order. The runtime map has no group node, so each group's own style is baked into its children as Tiled composes it: visible ANDs, opacity and the parallax factors multiply, the offsets add, and tint colours multiply per colour channel. Object layers take the visibility, opacity and offset the same way - ObjectLayer carries no parallax or tint of its own, so a group's contribution to those two is dropped for object layers only. An infinite: true (chunked) tile layer converts to an **unbounded** runtime TileLayer with no tiles populated eagerly - its data streams in on demand via the ChunkSource built for it, retrievable with getChunkSource after this call returns. The returned TileMap does **not** own the tileset textures - they remain in the Loader cache. Destroying the returned map does not unload textures.
Properties14
backgroundColor?: string
class: string
The validated raw map data this instance was built from.
height: number
Map height in tiles.
infinite: boolean
source: string
Resolved URL this map was loaded from.
tileHeight: number
Tile grid cell height in pixels.
tileWidth: number
Tile grid cell width in pixels.
width: number
Map width in tiles.
Source