Skip to main content

Utilities

Utility functions for aiding in writing common logic.

isInRect

Check if a point is inside a rectangular area.

isInRect(x, y, rect)
ParameterTypeDefaultNote
xnumber⚠️ required
ynumber⚠️ required
rectRectangle⚠️ required

Rectangle

Represent a rectangular area.

rect = {x, y, width, height}
ValueTypeNote
xnumbertop-left corner.
ynumbertop-left corner.
widthnumber
heightnumber

whereInGrid

Check where the point lies inside a tabular grid of cells.

cellX, cellY = whereInGrid(x, y, grid)
ParameterTypeDefaultNote
xnumber⚠️ required
ynumber⚠️ required
gridGrid⚠️ required

Grid

Represent a tabular grid.

grid = {x, y, width, height, columns, rows} 
ValuesTypeNote
xnumber
ynumber
widthnumber
heightnumber
columnsnumber
rowsnumber