GridLayer

GridLayer

A CanvasLayer responsible for drawing a square grid

Constructor

new GridLayer()

Source:

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:

type :String

Source:

The grid type rendered in this Scene

Type:

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}

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

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}

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

isNeighbor()

Source:

Test if a specific row and column position is a neighboring location to another row and column coordinate

measureDistance(…args)

Source:

Measure the distance between two pixel coordinates

Parameters:
Name Type Attributes Description
args Array <repeatable>

All args are forwarded to the Grid implementation measureDistance function