Segment

Defines a path segment with an anchor point and optional curve control points. Segments are created implicitly by the Path lineTo and curveTo commands.

Constructors

Segment (anchor: Point | number[], controlIn?: Point | number[], controlOut?: Point | number[])

Creates a path segment with an anchor point and optional curve control points.

Parameters

anchor Point | number[]

The anchor point of this segment. If no control points are defined the path will pass through this point.

controlIn? Point | number[]

The first curve control point of this segment, if any.

controlOut? Point | number[]

The second curve control point of this segment, if any.

Methods

addObserver

Adds an observer to be notified for changes.

Parameters

observer GeometryObserver

The observer to add.

Returns

Segment - The current Arc instance.

anchor

Gets the segment anchor point.

Returns

Point - The current anchor point.

anchor

Sets the segment anchor point.

Parameters

value Point | number[]

The new anchor point.

controlIn

Gets the first curve control point of this segment.

Returns

Point - The current control point.

controlIn

Sets the second curve control point of this segment.

Parameters

value Point | number[]

The new control point.

controlOut

Gets the second curve control point of this segment.

Returns

Point - The new control point.

controlOut

Sets the second curve control point of this segment.

Parameters

value Point | number[]

The new control point.

observers

Returns the list of observers.

Returns

GeometryObserver[] - The current observers.

removeObserver

Stops notifying the specified observer for changes.

Parameters

observer GeometryObserver

The observer to remove.

Returns

Segment - The current Arc instance.

resume

Resumes the notification to all observers for changes.

Returns

Segment - The current Arc instance.

suspend

Suspends the change notifications to all observers.

Returns

Segment - The current Arc instance.