Example of Snapping in Blazor Diagram Component
This sample shows how the diagram objects snap to the nearest intersection of gridlines or objects while being dragged or resized.
The gridline position toward which the diagram object snaps can be customized by using the SnapIntervals
property of the HorizontalGridLines
and VerticalGridLines
, specifying a set of intervals for snapping the objects. The SnapAngle
property allows you to define the angle to which the object needs to be rotated. The SnapLineStyle
property allows you to customize the style of the snap line. The Constraints
property controls the visibility of gridlines and enables or disables snapping. The horizontal and vertical gridlines are displayed when restrictions are set to ShowLines
. If the constraint is set to SnapToLines
, the object snaps to both the vertical and horizontal gridlines. With SnapToObject
, it jumps to line up with the closest element when you move or resize an element.