C

SnapSize

A SnapReference to snap the width or height of an item to the size of other rectangles.
Inheritance Hierarchy

Remarks

Instances of this class are created by collectSameSizeSnapReferences to snap to the widths or heights of fixedNodes.

Members

Show:

Constructors

Creates a new instance using the provided attributes.

Parameters

horizontal: boolean
Whether this instance shall be used to snap the width of an item. If false the height should be snapped instead.
size: number
The size to snap to.
rectangles: IEnumerable<Rect>
A list of rectangles with equal width or height, depending on horizontal.
weight: number
The weight (importance) of this snap reference. If more than one snap reference 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 reference - see tag for a typical use of this value.

Properties

Gets if size is the width or height of the rectangles.
true if size is the width, false if it is the height.
readonlyfinal
Gets the rectangles that have the same size.
These rectangles can be used when visualizing the snapped size.
readonlyfinal
Gets the size to snap to.
This size is the width if horizontal is true and the height otherwise.
readonlyfinal
Gets which types of items may snap to this snap reference.
readonlyfinal
Gets the tag that is associated with this snap reference.
The tag is most commonly used for the snap result tag.
readonlyfinal
Gets the weight/importance of this snap reference.
Greater values indicate greater importance.
readonlyfinal

Methods

Calculates a valid SnapResult that snaps the width or height of a reshaped rectangle to the size.

Depending on horizontal, the width or height of the reshaped rectangle is snapped.

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

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.

Return Value

SnapResult
A valid snap result to the size or null if no such snap result could be found.