Constructor
new SurfaceShapeTile(sector, level, row, column)
Constructs a surface shape tile.
Parameters:
Name | Type | Description |
---|---|---|
sector |
Sector | The sector this tile covers. |
level |
Level | The level this tile is associated with. |
row |
number | This tile's row in the associated level. |
column |
number | This tile's column in the associated level. |
- Source:
Throws:
-
If the specified sector or level is null or undefined, the row or column arguments are less than zero, or the specified image path is null, undefined or empty.
- Type
- ArgumentError
Members
cacheKey :string
A string to use as a cache key.
Type:
- string
- Source:
sector :Sector
The sector that bounds this tile.
Type:
- Source:
surfaceShapes :Array.<SurfaceShape>
The surface shapes that affect this tile.
Type:
- Array.<SurfaceShape>
- Source:
Methods
addSurfaceShape(surfaceShape)
Add a surface shape to this tile's collection of surface shapes.
Parameters:
Name | Type | Description |
---|---|---|
surfaceShape |
SurfaceShape | The surface shape to add. |
- Source:
clearShapes()
Clear all collected surface shapes.
- Source:
createCtx2D()
Create a new canvas and its 2D context on demand.
- Source:
getCacheKey() → {string}
Get a key suitable for cache look-ups.
- Source:
Returns:
- Type
- string
getSector() → {Sector}
The sector that bounds this tile.
- Source:
Returns:
- Type
- Sector
getShapes() → {Array.<SurfaceShape>}
Get all shapes that this tile references.
- Source:
Returns:
The collection of surface shapes referenced by this tile.
- Type
- Array.<SurfaceShape>
hasShapes() → {boolean}
Query whether any surface shapes have been collected.
- Source:
Returns:
Returns true if there are collected surface shapes.
- Type
- boolean
hasTexture(dc) → {boolean}
Determine whether the surface shape tile has a valid texture.
Parameters:
Name | Type | Description |
---|---|---|
dc |
DrawContext | The draw context. |
- Source:
Returns:
True if the surface shape tile has a valid texture, else false.
- Type
- boolean
setShapes(surfaceShapes)
Set the shapes this tile should reference.
Parameters:
Name | Type | Description |
---|---|---|
surfaceShapes |
Array.<SurfaceShape> | The collection of surface shapes to be referenced by this tile. |
- Source:
updateTexture(dc) → {Texture}
Redraw all of the surface shapes onto the texture for this tile.
Parameters:
Name | Type | Description |
---|---|---|
dc |
DrawContext |
- Source:
Returns:
- Type
- Texture