Constructor
new SquareGrid()
Methods
draw()
getCenter()
getGridPositionFromPixels()
getNeighbors()
getPixelsFromGridPosition()
getSnappedPosition()
highlightGridPosition()
measureDistances()
shiftPosition(x, y, dx, dy)
Shift a pixel position [x,y] by some number of grid units dx and dy
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The starting x-coordinate in pixels |
y |
number | The starting y-coordinate in pixels |
dx |
number | The number of grid positions to shift horizontally |
dy |
number | The number of grid positions to shift vertically |