This is the abstract base class used by the implementers of SnapContext to model the result of the mouse being snapped to a certain location.
Remarks
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.input.SnapResult
See Also
Properties
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.
- otherObject - Object
- The second SnapResult
Returns
- ↪number
- The comparison value of the two SnapResults' Weights
Implements
Returns a IVisualCreator instance that can be used to create a Visual for this result.
Returns
- ↪IVisualCreator
- A visual creator which creates a Visual which depicts this snap result.
See Also
Checks whether this instance is still snapped given the final mouse location.
Remarks
false
.Parameters
A map of options to pass to the method.
- unsnappedLocation - Point
- The unsnapped location.
- finalSnapState - SnapState
- The final snap state that has been used by the client.
Returns
- ↪boolean
- Whether the location are still snapped for this instance.
Core method that performs the actual snapping.
Constants
Gets a SnapResult representing that there is no snapping of the x or y coordinate.
Static Methods
createLabelSnapResult
(layoutParameter: ILabelModelParameter, weight: number, delta: Point, tag: Object, snapLine: SnapLine, snappedCoordinates: Point, movedObject: Object) : SnapResultFactory method that creates a SnapResult to which a ILabel will snap, based on the given snapLine
.
Parameters
A map of options to pass to the method.
- layoutParameter - ILabelModelParameter
- The ILabelModelParameter which represents the position to snap to.
- weight - number
- The weight of this result. The higher the weight, the more important it is.
- delta - Point
- The value to add to the mouse coordinates to snap to this result.
- tag - Object
- 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. - snapLine - SnapLine
- The snap line this class would snap to or
null
if it doesn't snap to aSnapLine
. - snappedCoordinates - Point
- The coordinates at the moved item at which the drawn snap line should end.
- movedObject - Object
- The moved object for which this result is created.
Class.ensure(GraphEditorInputMode)
More information.createPointSnapResult
(location: Point, weight: number, tag: Object, visualCreator: IVisualCreator, snapType: SnapTypes) : SnapResultFactory method that creates a SnapResult that snaps to a given location.
Parameters
A map of options to pass to the method.
- location - Point
- The location to snap to.
- weight - number
- The weight to assign to the result.
- tag - Object
- 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. - visualCreator - IVisualCreator
- The visual creator to use.
- snapType - SnapTypes
- The type of the snapping operation to apply.
Returns
- ↪SnapResult
- A result that snaps to the provided location using the provided mode.
Class.ensure(GraphEditorInputMode)
More information.createResizeSnapResult
(weight: number, delta: Point, tag: Object, rectangles: IEnumerable<IRectangle>, size: number, horizontal: boolean) : 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.
- weight - number
- The weight of this result. The higher the weight, the more important it is.
- delta - Point
- The value to add to the mouse coordinates to snap to this result.
- tag - Object
- 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. - rectangles - IEnumerable<IRectangle>
- The rectangles that have the same width or height as the node will. The rectangle are used for visualization and should include all objects for which a visualization should be displayed. Typically, these are all objects which have the same size and the object which is currently reshaped.
- size - number
- The target size to which the resized object will snap.
- horizontal - boolean
- Indicates whether width or height should snap.
true
if the width should snap.
Class.ensure(GraphEditorInputMode)
More information.createSnapLineSnapResult
(weight: number, delta: Point, tag: Object, snapLine: SnapLine, snappedLocation: Point, movedObject: Object, preferredSnapTypes?: SnapTypes) : 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.
- weight - number
- The weight of this result. The higher the weight, the more important it is.
- delta - Point
- The value to add to the mouse coordinates to snap to this result.
- tag - Object
- 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. - snapLine - SnapLine
- The snap line this class would snap to or
null
if it doesn't snap to aSnapLine
. - snappedLocation - Point
- The coordinates at the moved item at which the drawn snap line should end.
- movedObject - Object
- The moved object for which this result is created.
- preferredSnapTypes - SnapTypes
- Whether the cursor should preferably snap in horizontal or vertical direction.
Class.ensure(GraphEditorInputMode)
More information.