A SnapReference to snap the width or height of an item to the size of other rectangles.
Remarks
Type Details
- yFiles module
- view
Constructors
SnapSize
(horizontal: boolean, size: number, rectangles: IEnumerable<Rect>, weight: number, snappableItems?: GraphItemTypes, tag?: any)Creates a new instance using the provided attributes.
Parameters
A map of options to pass to the method.
- 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.
Remarks
Gets the rectangles that have the same size.
Remarks
Gets the size to snap to.
Remarks
true
and the height otherwise.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 weight/importance of this snap reference.
Methods
collectReshapeSnapResult
(evt: CollectSnapResultsEventArgs, reshapeContext: ReshapeRectangleContext, reshapedItem: IModelItem, suggestedLayout: Rect) : SnapResultCalculates a valid SnapResult that snaps the width or height of a reshaped rectangle to the size.
Remarks
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
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.
Returns
- ↪SnapResult?
- A valid snap result to the size or
null
if no such snap result could be found.