module:Line

module:Line

Line class
line demo

Constructor

# new module:Line(positionDefinition, points, optionsopt)

Line constructor

Parameters:
Name Type Attributes Description
positionDefinition PositionDefinition

First point

points Array.<PositionDefinition>

List of points

options LineOptions <optional>

Drawing options

Extends

Members

# (static) caps :LineCaps

Type:
  • LineCaps

# (static) defaultOptions :LineOptions

Type:
  • LineOptions

# points :Array.<Position>

Type:
  • Array.<Position>

Methods

# (static) from(definition) → {Line}

Parameters:
Name Type Description
definition Object

Line definition

Returns:
Type
Line

# trace(path) → {Line}

Draw the line

Parameters:
Name Type Description
path Path2D

Drawing context

Returns:

Itself

Type
Line

Type Definitions

# LineCaps

Type:
  • Object
Properties
Name Type Description
butt String

Caps cut straight at end points

round String

Round caps by adding a circle at end points, with a radius of lineWidth

square String

Square caps by adding a square at end points, with a size of lineWidth

# LineOptions

Type:
  • Object
Properties
Name Type Attributes Default Description
cap String <optional>
Line.caps.round

How the line end points looks

join String <optional>
Line.joins.round

How the line segment are join

fill String | ColorDefinition <optional>
null

Color used to fill, set to null for transparent

stroke String | ColorDefinition <optional>
Component.defaultOptions.fill

Color used to stroke, set to null for transparent

absolute Boolean <optional>
false

Should points be treated as absolute coordinates