Show:

ia.Shape Class

Defined in: ia\utils\Shape.js:1
Module: ia

Utility class for drawing shapes on a canvas.

Constructor

ia.Shape

()

Defined in ia\utils\Shape.js:1

Item Index

Methods

Properties

Methods

draw

(
  • name
  • ctx
  • x
  • y
  • size
)
static

Generic function for drawing a shape.

Parameters:

  • name Number

    The name of the shape to draw.

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The shape size.

drawArrowDown

(
  • ctx
  • x
  • y
  • size
)
static

Draws a downward-pointing arrow shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawArrowLeft

(
  • ctx
  • x
  • y
  • size
)
static

Draws a left-pointing arrow shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawArrowRight

(
  • ctx
  • x
  • y
  • size
)
static

Draws a right-pointing arrow shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawArrowUp

(
  • ctx
  • x
  • y
  • size
)
static

Draws an upward-pointing arrow.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawCircle

(
  • ctx
  • x
  • y
  • size
)
static

Draws a circle shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawDiamond

(
  • ctx
  • x
  • y
  • size
)
static

Draws a diamond shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawGradient

(
  • canvas
  • colorList
  • orientation
)
static

Draws the gradient.

Parameters:

  • canvas HTML Canvas Element

    The canvas to draw to.

  • colorList Array

    An array of color values.

  • orientation String

    "leftToRight"; "rightToLeft"; "topToBottom"; "bottomToTop" - default is "bottomToTop".

drawHorizontalLine

(
  • ctx
  • x
  • y
  • size
)
static

Draws a horizontal line.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawLine

(
  • ctx
  • x
  • y
  • size
)
static

Draws a line.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawMinus

(
  • ctx
  • x
  • y
  • size
)
static

Draws a minus shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawPlus

(
  • ctx
  • x
  • y
  • size
)
static

Draws a plus shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawSquare

(
  • ctx
  • x
  • y
  • size
)
static

Draws a square shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawStar

(
  • ctx
  • x
  • y
  • size
)
static

Draws a star shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawTriangleDown

(
  • ctx
  • x
  • y
  • size
)
static

Draws a downward-pointing triangle shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawTriangleLeft

(
  • ctx
  • x
  • y
  • size
)
static

Draws a left-pointing arrow shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawTriangleRight

(
  • ctx
  • x
  • y
  • size
)
static

Draws a right-pointing triangle shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawTriangleUp

(
  • ctx
  • x
  • y
  • size
)
static

Draws an upward-pointing triangle.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawVerticalLine

(
  • ctx
  • x
  • y
  • size
)
static

Draws a vertical line.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

drawX

(
  • ctx
  • x
  • y
  • size
)
static

Draws an x shape.

Parameters:

  • ctx HTML Canvas Context

    The graphics context to draw with.

  • x Number

    The x position to centre the shape on.

  • y Number

    The y position to centre the shape on.

  • size Number

    The size of the symbol.

Properties

ARROW_DOWN

String final static

Constant indicating a downward-pointing arrow shape.

Default: "arrow down"

ARROW_LEFT

String final static

Constant indicating a leftward-pointing arrow shape.

Default: "rrow left"

ARROW_RIGHT

String final static

Constant indicating a rightward-pointing arrow shape.

Default: "arrow right"

ARROW_UP

String final static

Constant indicating a upward-pointing arrow shape.

Default: "arrow up"

CIRCLE

String final static

Constant indicating a circle shape.

Default: "circle"

DIAMOND

String final static

Constant indicating a diamond shape.

Default: "diamond"

HORIZONTAL_LINE

String final static

Constant indicating a horizontal line.

Default: "horizontal line"

LINE

String final static

Constant indicating a line.

Default: "line"

MINUS

String final static

Constant indicating a minus shape.

Default: "minus"

PLUS

String final static

Constant indicating a plus shape.

Default: "plus"

SQUARE

String final static

Constant indicating a square shape.

Default: "square"

STAR

String final static

Constant indicating a star shape.

Default: "star"

TRIANGLE_DOWN

String final static

Constant indicating a downward-pointing triangle shape.

Default: "triangle down"

TRIANGLE_LEFT

String final static

Constant indicating a leftward-pointing triangle shape.

Default: "triangle left"

TRIANGLE_RIGHT

String final static

Constant indicating a rightward-pointing triangle shape.

Default: "triangle right"

TRIANGLE_UP

String final static

Constant indicating a upward-pointing triangle shape.

Default: "triangle up"

VERTICAL_LINE

String final static

Constant indicating a vertical line.

Default: "vertical line"

X

String final static

Constant indicating an x shape.

Default: "x"