C

SnapCircle

A SnapCircle represents a circle in the world coordinate system to which other items snap during interactive movements.
Inheritance Hierarchy

Remarks

GraphSnapContext makes use of this class to interactively snap moving elements to circles. The circle can be reduced to an arc by defining valid startAngle and endAngle.

The visualization of the circle can be styled with the yfiles-snap-reference-circle CSS class.

See Also

Similar to other SnapResults, the visualization can be styled with CSS. An overview of the different CSS styling options is presented in detail in the section CSS Styling Snap References .

Developer's Guide

Members

Show:

Constructors

Creates a new snap reference using the provided information.

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.

Parameters

center: Point
The center of the circle to snap to in world coordinates.
radius: number
The radius of the circle to snap to in world coordinates.
startAngle: number
The start angle of the arc in radians.
endAngle: number
The end angle of the arc in radians.
weight: number
The weight (importance) of this snap reference. If more than one snap reference is snapped to, the one with the greater weight will be used.
snappableItems: GraphItemTypes
The graph item types that may snap to this snap reference.
tag?: any
A tag that is associated with this snap reference - see tag for a typical use of this value.

Properties

Gets the center of the circle to snap to in world coordinates.
readonlyfinal
Gets the end angle of the arc in radians.

With the startAngle and this end angle, 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.

readonlyfinal
Gets the radius of the circle to snap to in world coordinates.
readonlyfinal
Gets which types of items may snap to this snap reference.
readonlyfinal
Gets the start angle of the arc in radians.

With this start angle and the 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.

readonlyfinal
Gets the tag that is associated with this snap reference.
The tag is most commonly used for the snap result tag.
readonlyfinal
Gets the weight/importance of this snap reference.
Greater values indicate greater importance.
readonlyfinal

Methods

Collects a valid SnapResult that snaps the movedPoint to this circle.

A snap result is considered to be valid if the projection of the movedPoint onto this circle hits the circle (or arc) and the distance between the moved and the projected point is not bigger than the snapDistance.

If a valid SnapResult is found, it is added to the evt and returned.

Parameters

evt: CollectSnapResultsEventArgs
The arguments describing the movement the SnapResult shall be created for.
movedItem: IModelItem
The item that is currently moved.
movedPoint: Point
The location that shall be snapped to the circle.
snapDistance: number
The maximum distance the moved point may snap to the circle.

Return Value

SnapResult
A valid snap result on this circle or null if no such snap result could be found.