Skip to main content

Units and location

Units

Units are used to define control size and movement distance. *Dot and box supports two types of units:

  • default units created with brackets
(90,150)
info

default units usually refer to screen pixels, however it's not a rule and it depends on canvas api implementation details

  • grid cell units created with square brackets
[2,4]

which means: 2 times cellSize (x axis) by 4 times cellSize (y axis).

info

by default cell size is 50 units. It was created to make on screen calculations easier.

so: [2,4] is equal to (100,200)

Location

Just like with the size, location can be expressed in two types of units: default and grid cells.

Controls are placed at point (0,0) on the dots-and-boxes surface area by default. Which is more o less center of the dot and box surface.

When using grid cells location [0,0] refers to right bottom side of point (0,0) marked as white dot at center below