Members
grid :PIXI.Container
- Source:
The Grid container
Type:
- PIXI.Container
h
- Source:
Get grid unit height
highlight :PIXI.Container
- Source:
The Grid Highlight container
Type:
- PIXI.Container
highlightLayers :Object
- Source:
Map named highlight layers
Type:
- Object
size :number
- Source:
A convenient reference to the pixel grid size used throughout this layer
Type:
- number
type :string
- Source:
The grid type rendered in this Scene
Type:
- string
w
- Source:
Get grid unit width
Methods
addHighlightLayer(name)
- Source:
Define a new Highlight graphic
Parameters:
Name | Type | Description |
---|---|---|
name |
clearHighlightLayer(name)
- Source:
Clear a specific Highlight graphic
Parameters:
Name | Type | Description |
---|---|---|
name |
destroyHighlightLayer(name)
- Source:
Destroy a specific Highlight graphic
Parameters:
Name | Type | Description |
---|---|---|
name |
(async) draw(preview)
- Source:
Draw the grid
Parameters:
Name | Type | Description |
---|---|---|
preview |
Object | Override settings used in place of those saved to the Scene data |
getCenter() → {Array.<number>}
- Source:
Given a pair of coordinates (x, y), return the center of the grid square which contains that point
Returns:
An Array [x, y] of the central point of the square which contains (x, y)
- Type
- Array.<number>
getSnappedPosition(x, y, interval)
- Source:
Given a pair of coordinates (x1,y1), return the grid coordinates (x2,y2) which represent the snapped position
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The exact target location x |
y |
number | The exact target location y |
interval |
number | An interval of grid spaces at which to snap, default is 1. |
getTopLeft() → {Array.<number>}
- Source:
Given a pair of coordinates (x, y) - return the top-left of the grid square which contains that point
Returns:
An Array [x, y] of the top-left coordinate of the square which contains (x, y)
- Type
- Array.<number>
isNeighbor()
- Source:
Test if a specific row and column position is a neighboring location to another row and column coordinate
measureDistance(origin, target) → {number}
- Source:
Measure the grid-wise distance between two point coordinates.
Example
let distance = canvas.grid.measureDistance({x: 1000, y: 1000}, {x: 2000, y: 2000});
Parameters:
Name | Type | Description |
---|---|---|
origin |
Object | The origin point |
target |
Object | The target point |
Returns:
The measured distance between these points
- Type
- number
measureDistances(segments, options)
- Source:
Measure the distance traveled over an array of distance segments.
Parameters:
Name | Type | Description |
---|---|---|
segments |
Array.<object> | An array of measured segments |
options |
Options | Additional options which modify the measurement |