Snapper
A Snapper component is what ‘snaps’ to a Snap Target. This is typically done by grabbing an object by it’s Handle and releasing it near the Snap Target, however it is also possible to snap via code too.
Field | Description |
---|---|
Handles | Handles attached to this object. When one of these handles is disengaged, the Snapper will attempt to snap to the available target. |
Start Position | (Optional) The snap target this should start on. |
Fallback Snap Targets | These snap targets will always be considered when snapping. |
On Snap | Event triggered when the Snapper snaps to a SnapTarget |
On Unsnap | Event triggered when the Snapper unsnaps from a SnapTarget |
As stated above, it is possible to snap a Snapper to a Snap Target via code.
snapper.Snap(snapTarget);
// Snap ignoring requirements (force snap)
snapper.Snap(snapTarget, true);
This method can also be called from the Snap Target, with the Snapper as the parameter.
snapTarget.Snap(snapper);
// Snap ignoring requirements (force snap)
snapTarget.Snap(snapper, true);