A snap line is a line segment in the world coordinate system to which other items (lines or points) snap during interactive movements.
Remarks
Type Details
- yFiles module
- view
Constructors
SnapLine
(visualizationType: SnapReferenceVisualizationType, coordinates: Point, from: Point, to: Point, weight: number, snappableItems?: GraphItemTypes, tag?: any)Creates a new snap line using the provided attributes.
Parameters
A map of options to pass to the method.
- visualizationType - SnapReferenceVisualizationType
- The type of the visual representation of this snap line.
- coordinates - Point
- The coordinates of the center point of the snap line.
- from - Point
- The first location that delimits this snap line.
- to - Point
- The second location that delimits this snap line.
- weight - number
- The weight (importance) of this snap line. If more than one snap line 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 line - see tag for a typical use of this value.
Properties
Gets the coordinates of the center point of the snap line.
Gets or sets the first location that delimits this snap line.
Gets which types of items may snap to this snap reference.
Defined in
Gets the tag that is associated with this snap reference.
Gets or sets the second location that delimits this snap line.
Gets the visualization type which determines the visual appearance of the snap line.
Gets the weight/importance of this snap reference.
Methods
collectPointSnapResult
(evt: CollectSnapResultsEventArgs, movedItem: IModelItem, movedPoint: Point) : SnapResultCollects a valid SnapResult that snaps the movedPoint
to this line.
Remarks
A snap result is considered to be valid if the projection of the movedPoint
onto this line hits the snap line 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 line.
Returns
- ↪SnapResult?
- A valid snap result on this line or
null
if no such snap result could be found.