A SnapCircle represents a circle in the world coordinate system to which other items snap during interactive movements.
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.
Related Reading in the Developer's Guide
Type Details
- yFiles module
- view
Constructors
SnapCircle
(center: Point, radius: number, startAngle: number, endAngle: number, weight: number, snappableItems: GraphItemTypes, tag?: any)Creates a new snap reference using the provided information.
Remarks
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
A map of options to pass to the method.
- 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.
Gets the end angle of the arc in radians.
Remarks
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.
Gets which types of items may snap to this snap reference.
Defined in
Gets the start angle of the arc in radians.
Remarks
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.
Gets the tag that is associated with this snap reference.
Gets the weight/importance of this snap reference.
Methods
collectPointSnapResult
(evt: CollectSnapResultsEventArgs, movedItem: IModelItem, movedPoint: Point, snapDistance: number) : SnapResultCollects a valid SnapResult that snaps the movedPoint
to this circle.
Remarks
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
A map of options to pass to the method.
- 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.
Returns
- ↪SnapResult?
- A valid snap result on this circle or
null
if no such snap result could be found.