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
property | explanation | type | default value |
---|---|---|---|
id | the unique id of the segment | String | |
type | the type of the segment | String | “segment” |
vertex1 | the first vertex this segment goes through | Vertex | |
vertex2 | the second vertex this segment goes through | Vertex | |
center | get the center point of the segment | Point |
Methods
method | explanation | return 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 |