An orthogonal snap line, in other words, one that is parallel to the x or y axis.
Type Details
- yFiles module
- view
Constructors
OrthogonalSnapLine
(orientation: SnapLineOrientation, snapType: SnapLineSnapTypes, visualizationType: SnapReferenceVisualizationType, coordinates: Point, croppable: boolean, 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.
- orientation - SnapLineOrientation
- The orientation of the snap line. This is one of HORIZONTAL or VERTICAL.
- snapType - SnapLineSnapTypes
- visualizationType - SnapReferenceVisualizationType
- The type of the visual representation of this snap line.
- coordinates - Point
- The coordinates of the center point of the snap line.
- croppable - boolean
- Whether this snap line may get cropped at obstacles if cropSnapLines is set.
- 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.
OrthogonalSnapLine
(orientation: SnapLineOrientation, snapType: SnapLineSnapTypes, visualizationType: SnapReferenceVisualizationType, coordinates: Point, from: number, to: number, croppable: boolean, 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.
- orientation - SnapLineOrientation
- The orientation of the snap line. This is one of HORIZONTAL or VERTICAL.
- snapType - SnapLineSnapTypes
- 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 - number
- The smaller value of the coordinate that delimits this snap line.
- to - number
- The greater value of the coordinate that delimits this snap line.
- croppable - boolean
- Whether this snap line may get cropped at obstacles if cropSnapLines is set.
- 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 if this snap line may get cropped at obstacles if cropSnapLines is set.
Gets the orientation of the snap line.
Remarks
Gets which types of items may snap to this snap reference.
Defined in
Gets the tag that is associated with this snap reference.
Gets the visualization type which determines the visual appearance of the snap line.
Defined in
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 orthogonal line.
Remarks
A snap result is considered to be valid if the projection of the movedPoint
onto this line hits the 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 this line.
Returns
- ↪SnapResult?
- A valid snap result on this line or
null
if no such snap result could be found.
Overrides
collectReshapeSnapResult
(evt: CollectSnapResultsEventArgs, reshapeContext: ReshapeRectangleContext, reshapedItem: IModelItem, suggestedLayout: Rect, snapType: SnapLineSnapTypes) : SnapResultCalculates a valid SnapResult that snaps the side of a reshaped rectangle described by the snapType
to this orthogonal line.
Remarks
The snapType
describes which side of the rectangle should be snapped. If this snapType doesn't support the given snap type, null
is returned. No combined SnapLineSnapTypes are supported. If snap results shall be created for multiple sides, this method should be called for each side individually.
The reshape behavior of the rectangle relative to the pointer movement is described by the reshapeContext
and a snap result is only considered to be valid, if the necessary pointer delta resulting in the snap 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.
- reshapeContext - ReshapeRectangleContext
- The reshape context that contains information about the nature of the resize.
- reshapedItem - IModelItem
- The item that is currently reshaped.
- suggestedLayout - Rect
- The layout of the item as it would be if the pointer location would not be snapped.
- snapType - SnapLineSnapTypes
- The side of the reshaped rectangle that shall be snapped.
Returns
- ↪SnapResult?
- A valid snap result on this line or
null
if no such snap result could be found.
collectSegmentSnapResult
(evt: CollectSnapResultsEventArgs, movedItem: IModelItem, from: number, to: number, orthogonalCoordinate: number, snapType: SnapLineSnapTypes) : SnapResultCalculates a valid SnapResult that snaps the orthogonal segment defined by the given parameters to this orthogonal line.
Remarks
The orthogonal segment to snap is considered to have the same orientation as this line and is defined by the from
, to
, and orthogonalCoordinate
parameters.
The snapType
describes which side of a rectangle the orthogonal segment corresponds to. If this snapType doesn't support the given snap type, null
is returned. No combined SnapLineSnapTypes are supported. If snap results shall be created for multiple sides, this method should be called for each side individually.
A snap result is considered to be valid if the extent of the orthogonal segment and this line intersect in orientation direction and if the orthogonal distance between both 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.
- from - number
- The start value of the orthogonal segment to snap.
- to - number
- The end value of the orthogonal segment to snap.
- orthogonalCoordinate - number
- The coordinate in the direction orthogonal to the segment orientation.
- snapType - SnapLineSnapTypes
- The side of a rectangle the orthogonal segment corresponds to.
Returns
- ↪SnapResult?
- A valid snap result on this line or
null
if no such snap result could be found.