API Docs for: 0.0.2
Show:

canvas.Polygon Class

Extends canvas.Polyline
Module: Canvas

Class for drawing polygons.

Constructor

canvas.Polygon

(
  • points
  • config
)

Parameters:

Example:

var polyline = new ludo.canvas.Polygon('20,20 40,25 60,40 80,120 120,140 200,180');

Item Index

Methods

getPoint

(
  • index
)
Object | Undefined

Return x and y of a point

Parameters:

Returns:

Object | Undefined: x and y

getPosition

() Object

Get position of polyline, min X and min Y)

Returns:

Object: x and y

getSize

() Object

Get size of polyline (max X - min X) and (max X - min Y)

Returns:

Object: x and y

setPoint

(
  • index
  • x
  • y
)

Set new x and y for one of the points.

Parameters:

Example:

     var polyline = new ludo.canvas.Polyline('20,20 40,25 60,40 80,120 120,140 200,180');
polyline.setPoint(0,10,5);
polyline.setPoint(1,120,40);

will change the points to

'10,5 120,40 60,40 80,120 120,140 200,180'