Segment

The Segment class represents a line or a curve that connects two vertices in a path. Segments are automatically created when vertices are added to a path.

Properties

propertyexplanationtypedefault value
id the unique id of the segmentString
type the type of the segmentString“segment”
vertex1 the first vertex this segment goes throughVertex
vertex2 the second vertex this segment goes throughVertex
center get the center point of the segmentPoint

Methods

methodexplanationreturn type
translate(dx, dy)move the segment by the given parameters
dx (Number): number of pixels to move in the x direction
dy (Number): number of pixels to move in the y direction
void