C

SnapResult

This is the base class used by the implementers of SnapContext to model the result of the pointer being snapped to a certain location.
ImplementsInheritance Hierarchy

Remarks

It can be used to obtain a IVisualCreator that will be included in the view if the result is actually snapped. The SnapConstraint describing the final snapped location is determined by combining the results with the highest weights.

Created snap lines can also be styled with CSS. Each snap reference provides the yfiles-snap-reference CSS class and a specific CSS class depending on the actual snap reference type.

See Also

An overview of the different CSS styling options is presented in detail in the section CSS Styling Snap References .

Developer's Guide

Members

No filters for this type

Constructors

Initializes the tag, weight and constraint with the given values.

Parameters

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.
This value contains the preferred snap location and can be used to find common point locations with other results.
final
Gets the IModelItem instance that is snapped by this result.
It can be used to obtain information to visualize the result. This property may be null if the result was not created for a specific IModelItem.
final
Gets the anchor point of the item that is snapped by this result.
It can be used to obtain information to visualize the result. This property may be null if the result was not created for a specific IModelItem or anchor point on the item.
conversionfinal
Gets or sets the IObjectRenderer<SnapResult> instance that is used to create an IVisualCreator and with it a Visual for this result.
final

See Also

API
VOID_OBJECT_RENDERER
Gets the reference instance that was used to create this result.
It can be used to obtain information to visualize the result. This property may be null if the result was created without using a reference.
final
Gets 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.
final
Gets or sets the weight of this result.
Higher weights represent more important results.
final

Methods

Implements the IComparable interface using weight.
final

Parameters

other: any
The second SnapResult

Return Value

number
The comparison value of the two SnapResults' Weights

Static Methods

Factory method that creates a SnapResult that snaps to a given circle.
static

Parameters

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.

Return Value

SnapResult
A SnapResult that snaps to the provided circle.
Factory method that creates a SnapResult which represents a SnapLine to which the current moved item will potentially snap.
static

Parameters

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 a SnapLine.
renderer?: IObjectRenderer<SnapResult>
The renderer to use. If omitted, a new default renderer will be created.

Return Value

SnapResult
A SnapResult that represents the snap line this item will potentially snap to.
Factory method that creates a SnapResult which snaps to a given size through a resize operation.
static

Parameters

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.

Return Value

SnapResult
A SnapResult that represents the snap to the given size through a resize operation.
Factory method that creates a SnapResult using the given constraint.
static

Parameters

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.

Return Value

SnapResult
A result that uses the provided constraint.