items

predefined. Namespace

items

Description:
  • Factories for predefined items.
Source:

Methods

(static) circle(radius, colouropt, properties) → {Object}

Description:
  • Generate a circle item.
Source:
Parameters:
Name Type Attributes Default Description
radius number
colour string <optional>
'yellow' Fill colour for the circle.
properties Object Location and orientation options for the item. See module:shared.Item members for available parameters.
Returns:
An object with the parameters for a circle item with the given radius, filled in with the given colour.
Type
Object

(static) element(x, y, width, height, properties) → {Object}

Description:
  • Generate a rectangular element.
Source:
Parameters:
Name Type Description
x number
y number
width number
height number
properties Object Location and orientation options for the item, plus any appropriate attributes. See module:shared.WamsElement members for available parameters.
Returns:
An object with the parameters for a rectangular item with the given width and height, filled in with the given colour.
Type
Object

(static) html(width, height, properties) → {Object}

Description:
  • Generate an item that wraps the given html.
Source:
Parameters:
Name Type Description
width number
height number
properties Object Location and orientation options for the item, plus any appropriate attributes. See module:shared.WamsElement members for available parameters.
Returns:
An object with the parameters for an iframe with the given HTML content.
Type
Object

(static) image(src, properties) → {Object}

Description:
  • Provides an image description, complete with a hitbox only if both 'width' and 'height' properties are present. Note that the hitbox will be rectangular, with the top left corner at the 'x' and 'y' coordinates.
Source:
Parameters:
Name Type Description
src string Route path to the image.
properties Object Location and orientation options for the image item. See module:shared.Item members for available parameters.
Returns:
An object with the parameters for an image item using the given source.
Type
Object

(static) line(dx, dy, widthopt, colouropt, properties) → {Object}

Description:
  • Generate a line segment item.
Source:
Parameters:
Name Type Attributes Default Description
dx number length of the x portion of the line
dy number length of the y portion of the line
width number <optional>
1 The width of the line.
colour string <optional>
'black' The colour of the line.
properties Object Location and orientation options for the item. See module:shared.Item members for available parameters.
Returns:
An object with the parameters for a line item with the given endpoints, width, and colour.
Type
Object

(static) oval(radiusX, radiusY, colouropt, properties) → {Object}

Description:
  • Generate an oval item.
Source:
Parameters:
Name Type Attributes Default Description
radiusX number
radiusY number
colour string <optional>
'yellow' Fill colour for the oval.
properties Object Location and orientation options for the item. See module:shared.Item members for available parameters.
Returns:
An object with the parameters for an oval item.
Type
Object

(static) polygon(points, colouropt, properties) → {Object}

Description:
  • Generate a polygonal item.
Source:
Parameters:
Name Type Attributes Default Description
points Array.<module:shared.Point2D> Not necessarily actual Point2D objects, can just be objects with x and y properties.
colour string <optional>
'green' Fill colour for the polygon.
properties Object Location and orientation options for the item. See module:shared.Item members for available parameters.
Returns:
An object with the parameters for a generic polygon, filled in with the given colour.
Type
Object

(static) rectangle(width, height, colouropt, properties) → {Object}

Description:
  • Generate a rectangular block item centered on the x, y coordinates given in `properties`.
Source:
Parameters:
Name Type Attributes Default Description
width number
height number
colour string <optional>
'blue' Fill colour for the rectangle.
properties Object Location and orientation options for the item. See module:shared.Item members for available parameters.
Returns:
An object with the parameters for a rectangular item with the given width and height, filled in with the given colour.
Type
Object

(static) square(length, colouropt, properties) → {Object}

Description:
  • Generate a square block item centered on the x, y coordinates given in `properties`.
Source:
Parameters:
Name Type Attributes Default Description
length number
colour string <optional>
'red' Fill colour for the square.
properties Object Location and orientation options for the item. See module:shared.Item members for available parameters.
Returns:
An object with the parameters for a square item with the given side length, filled in with the given colour.
Type
Object