Field Class
The Field
class represents a single field within the model's grid. A Field
is an Entity
that cannot move and has fix coordinates within the Model
. Field
objects are automatically created when a Model
is created or resized, they cannot be created manually.
Properties
field.x: number
read-only
The X coordinate of the Field
.
field.y: number
read-only
The Y coordinate of the Field
.
field.color: string
The color of the Field
, must be a valid CSS color.
field.neighbors: array
read-only
The array of the up to 8 neighboring Field
s.
field.neighborsInRadius(radius: number): array
read-only
The array Field
s within the given radius, radius
must be positive.
Events
click
Sends an FieldEvent
when the Field is clicked.
FieldEvent.target
: theField
object that was clicked.FieldEvent.field
: theFieldEvent
that was clicked.