Line

Line

{Object} Line Line object

Constructor

new Line()

Description:
  • Create a Line object
Source:
Properties:
Name Type Attributes Default Description
start Point Start X & Y axis coordinates
end Point End X & Y axis coordinates
stroke Stroke Stroke properties
shadow Shadow Shadow properties
lineCap string <optional>
'round' Line cap's end points shape
canvas HTMLCanvasElement 2D canvas context
controlPoints ControlPoints Control point properties
options Options Options for this object
position Position Position properties

Methods

anchor() → {Anchor}

Description:
  • Get anchor
Source:
Returns:
Anchor properties
Type
Anchor

bounds() → {Object}

Description:
  • Get bounds of object
Source:
Returns:
Bounds of object
Type
Object

canvas(value)

Description:
  • Set canvas value
Source:
See:
Parameters:
Name Type Description
value string Canvas id

canvas() → {string}

Description:
  • Get canvas value
Source:
See:
Returns:
Canvas id
Type
string

center() → {Point}

Description:
  • Get center of this object
Source:
Returns:
Center point coordinates
Type
Point

controlPoints() → {ControlPoints}

Description:
  • Get control point properties
Source:
Returns:
Control points properties
Type
ControlPoints

curve(p0, p1, p2, p3)

Description:
  • Set control points for bezier curve
Source:
Parameters:
Name Type Description
p0 number Control point 0
p1 number Control point 1
p2 number Control point 2
p3 number Control point 3

draw(canvas)

Description:
  • Draw this object
Source:
Parameters:
Name Type Description
canvas string Canvas Id

drawPoints()

Description:
  • Draws start & end points
Source:

end(value)

Description:
  • Set ending point
Source:
Parameters:
Name Type Description
value Point Ending point

end() → {Point}

Description:
  • Set ending point
Source:
Returns:
Ending point
Type
Point

isThere(line)

Description:
  • Check whether the passed object is already present
Source:
Parameters:
Name Type Description
line Line Object to validate

lineCap(value)

Description:
  • Set line cap
Source:
Parameters:
Name Type Description
value string Line cap

lineCap() → {string}

Description:
  • Get line cap
Source:
Returns:
Line cap
Type
string

move(degree, distance)

Description:
  • Move this object
Source:
Parameters:
Name Type Description
degree number Direction to move; in degrees
distance number Distance to move

options() → {Options}

Description:
  • Get options properties
Source:
Returns:
Options properties
Type
Options

point(value)

Description:
  • Set point
Source:
See:
Parameters:
Name Type Description
value Point X & Y coordinates

point() → {Point}

Description:
  • Get point
Source:
See:
Returns:
X & Y coordinates
Type
Point

point(value)

Description:
  • Set point
Source:
Parameters:
Name Type Description
value Point X & Y coordinates

point() → {Point}

Description:
  • Get point
Source:
Returns:
X & Y coordinates
Type
Point

position() → {Position}

Description:
  • Get position properties
Source:
Returns:
Position properties
Type
Position

rotate(degree, anchoropt, clearopt)

Description:
  • Rotate this object
Source:
See:
Parameters:
Name Type Attributes Default Description
degree number Distance to rotate; in degrees
anchor string <optional>
'center' Anchoring point during rotation
clear number <optional>
true Clear canvas during each rotation

shadow() → {Shadow}

Description:
  • Get shadow properties
Source:
Returns:
Shadow properties
Type
Shadow

showControlPoints(offsetopt, fontSizeopt)

Description:
  • Show control points for this object
Source:
Parameters:
Name Type Attributes Default Description
offset number <optional>
10 Offset of control points y origin
fontSize number <optional>
16 Control points font size

showCoordinates(offsetopt, fontSizeopt)

Description:
  • Shows coordinates of this object
Source:
Parameters:
Name Type Attributes Default Description
offset number <optional>
10 Offset of coordinates y origin
fontSize number <optional>
16 Coordinates font size

start(value)

Description:
  • Set starting point
Source:
Parameters:
Name Type Description
value Point Starting point

start() → {Point}

Description:
  • Set starting point
Source:
Returns:
Starting point
Type
Point

stroke(value)

Description:
  • Set stroke properties
Source:
Parameters:
Name Type Description
value Stroke Stroke properties

stroke() → {Stroke}

Description:
  • Get stroke properties
Source:
Returns:
Stroke properties
Type
Stroke

x(value)

Description:
  • Set x-axis value
Source:
See:
Parameters:
Name Type Description
value number X coordinate value

x() → {number}

Description:
  • Get x-axis value
Source:
See:
Returns:
X coordinate value
Type
number

x(value)

Description:
  • Set x-axis value
Source:
Parameters:
Name Type Description
value number X coordinate value

x() → {number}

Description:
  • Get x-axis value
Source:
Returns:
X coordinate value
Type
number

y(value)

Description:
  • Set y-axis value
Source:
See:
Parameters:
Name Type Description
value number Y coordinate value

y() → {number}

Description:
  • Get y-axis value
Source:
See:
Returns:
Y coordinate value
Type
number

y(value)

Description:
  • Set y-axis value
Source:
Parameters:
Name Type Description
value number Y coordinate value

y() → {number}

Description:
  • Get y-axis value
Source:
Returns:
Y coordinate value
Type
number