This is the base class used by the implementers of SnapContext to model the result of the pointer being snapped to a certain location.
Remarks
Type Details
- yFiles module
- view
See Also
Constructors
SnapResult
(constraint: SnapConstraint, weight: number, tag?: any, item?: IModelItem, itemAnchor?: Point, reference?: SnapReference, renderer?: IObjectRenderer<SnapResult>)Initializes the tag, weight and constraint with the given values.
Parameters
A map of options to pass to the method.
- constraint - SnapConstraint
- The snap constraint describing valid pointer locations for this result.
- weight - number
- The weight of this result.
- tag - any
- The tag associated with this result.
- item - IModelItem
- The item that is snapped by this result.
- itemAnchor - Point
- The anchor point of the
item
that is snapped by this result. - reference - SnapReference
- The reference this result is created for.
- renderer - IObjectRenderer<SnapResult>
- The renderer to create the Visual for this result. If omitted, a new default renderer will be created.
Properties
Gets the snap constraint describing valid pointer locations for this result.
Remarks
Gets the IModelItem instance that is snapped by this result.
Remarks
null
if the result was not created for a specific IModelItem.Gets the anchor point of the item that is snapped by this result.
Remarks
null
if the result was not created for a specific IModelItem or anchor point on the item.Gets or sets the IObjectRenderer<SnapResult> instance that is used to create an IVisualCreator and with it a Visual for this result.
Gets the tag associated with this result.
Remarks
null
), only the one with the highest weight will be rendered.Methods
Implements the IComparable interface using weight.
Parameters
A map of options to pass to the method.
- other - any
- The second SnapResult
Returns
- ↪number
- The comparison value of the two SnapResults' Weights
Implements
Static Methods
createCircleSnapResult
(constraint: SnapConstraint, weight: number, tag: any, item: IModelItem, itemAnchor: Point, snapCircle: SnapCircle, renderer?: IObjectRenderer<SnapResult>) : SnapResultFactory method that creates a SnapResult that snaps to a given circle.
Parameters
A map of options to pass to the method.
- constraint - SnapConstraint
- The snap constraint describing the valid pointer location for the created result.
- weight - number
- The weight to assign to the result.
- tag - any
- The tag associated with this result. If more than one result uses the same tag (not
null
), only the one with the highest weight will be rendered. - item - IModelItem
- The item that is snapped by this result.
- itemAnchor - Point
- The anchor point of the
item
that is snapped by this result. - snapCircle - SnapCircle
- The circle reference used to create a visualization if no
renderer
is passed. - renderer - IObjectRenderer<SnapResult>
- The renderer to use. If omitted, a new default renderer will be created.
Returns
- ↪SnapResult
- A SnapResult that snaps to the provided circle.
createLineSnapResult
(constraint: SnapConstraint, weight: number, tag: any, item: IModelItem, itemAnchor: Point, snapLine: SnapLine, renderer?: IObjectRenderer<SnapResult>) : SnapResultFactory method that creates a SnapResult which represents a SnapLine to which the current moved item will potentially snap.
Parameters
A map of options to pass to the method.
- constraint - SnapConstraint
- The snap constraint describing valid pointer locations for the created result.
- weight - number
- The weight of this result. The higher the weight, the more important it is.
- tag - any
- The tag associated with this result. If more than one result uses the same tag (not
null
), only the one with the highest weight will be rendered. - item - IModelItem
- The moved object for which this result is created.
- itemAnchor - Point
- The coordinates at the moved item at which the drawn snap line should end. A visual representation of a snap line is usually drawn from the center to these coordinates. This may, however, depend on the implementation.
- snapLine - SnapLine
- The snap line this class would snap to or
null
if it doesn't snap to aSnapLine
. - renderer - IObjectRenderer<SnapResult>
- The renderer to use. If omitted, a new default renderer will be created.
Returns
- ↪SnapResult
- A SnapResult that represents the snap line this item will potentially snap to.
createResizeSnapResult
(constraint: SnapConstraint, weight: number, tag: any, item?: IModelItem, snapSize?: SnapSize, renderer?: IObjectRenderer<SnapResult>) : SnapResultFactory method that creates a SnapResult which snaps to a given size through a resize operation.
Parameters
A map of options to pass to the method.
- constraint - SnapConstraint
- The snap constraint describing valid pointer locations for this result.
- weight - number
- The weight of this result. The higher the weight, the more important it is.
- tag - any
- The tag associated with this result. If more than one result uses the same tag (not
null
), only the one with the highest weight will be rendered. - item - IModelItem
- The item that is snapped by this result.
- snapSize - SnapSize
- The SnapSize reference used to create this result.
- renderer - IObjectRenderer<SnapResult>
- The renderer to use. If omitted, a new default renderer will be created.
Returns
- ↪SnapResult
- A SnapResult that represents the snap to the given size through a resize operation.
createSnapResult
(constraint: SnapConstraint, weight: number, tag?: any, item?: IModelItem, itemAnchor?: Point, reference?: SnapReference, renderer?: IObjectRenderer<SnapResult>) : SnapResultFactory method that creates a SnapResult using the given constraint
.
Parameters
A map of options to pass to the method.
- constraint - SnapConstraint
- The snap constraint describing the valid pointer location for the created result.
- weight - number
- The weight to assign to the result.
- tag - any
- The tag associated with this result. If more than one result uses the same tag (not
null
), only the one with the highest weight will be rendered. - item - IModelItem
- The item that is snapped by this result.
- itemAnchor - Point
- The anchor point of the
item
that is snapped by this result. - reference - SnapReference
- The reference the result shall be created for.
- renderer - IObjectRenderer<SnapResult>
- The renderer to use. If omitted, a new default renderer will be created.
Returns
- ↪SnapResult
- A result that uses the provided constraint.