C

SnapConstraint
abstract

Implementations of this class describe the constraint for a pointer location so that a SnapResult is considered to be snapped.
Inheritance Hierarchy

Remarks

This class usually does not need to be subclassed. Instead, the factory methods createPointConstraint, createLineConstraint, and createCircleConstraint should be called.

The location is a preferred location that satisfies this constraint.

Members

Show:

Constructors

Creates a new instance using the given location.
protected

Parameters

location: Point
The preferred location of this constraint.

Properties

A preferred location that satisfies this constraint.
conversionfinal

Methods

Returns if the finalLocation satisfies this constraint.
This method is used when collecting the SnapResults to visualize for a final snapped location.
abstract

Parameters

finalLocation: Point
The location to check.

Return Value

boolean
true, if the finalLocation satisfies this constraint, false otherwise.
Tries to merge the current with the given constraint.
The merged SnapConstraint describes the pointer location that satisfies both constraints. If no constraint can be found that satisfies both constraints, null is returned.
abstract

Parameters

constraint: SnapConstraint
The constraint that is tried to be merged into the current one.

Return Value

SnapConstraint
The merged SnapConstraint or null if none could be found.

Static Methods

Creates a constraint describing the points on a circle defined by the given center and radius.

With the startAngle and endAngle the circle can be reduced to an arc. Both values are interpreted in radians clockwise from the positive x-axis.

If startAngle and endAngle are equal, the constraint uses the full circle, otherwise it uses the arc starting from startAngle clockwise to endAngle.

static

Parameters

location: Point
The preferred location on the circle.
unSnappedLocation: Point
The current not snapped pointer location.
snapDistance: number
A maximum distance that should be considered in tryMerge.
center: Point
The center of the circle.
radius: number
The radius of the circle.
startAngle?: number
The start angle of the arc in radians.
endAngle?: number
The end angle of the arc in radians.

Return Value

SnapConstraint
A configured SnapConstraint that describes the points on a circle.
Creates a constraint describing an affine line defined by the given location and direction.
static

Parameters

location: Point
The preferred location on the affine line.
unSnappedLocation: Point
The current not snapped pointer location.
snapDistance: number
A maximum distance that should be considered in tryMerge.
direction: Point
The direction vector of the affine line.

Return Value

SnapConstraint
A configured SnapConstraint that describes the affine line.
Creates a constraint describing the single valid given location.
static

Parameters

location: Point
The location of the constraint.

Return Value

SnapConstraint
The configured SnapConstraint