Class SnapLinkReshapingTool

GoDiagram®
v10.0.12
by Northwoods Software®

The SnapLinkReshapingTool class lets the user snap link reshaping handles to the nearest grid point.

Inheritance
SnapLinkReshapingTool
Namespace: Northwoods.Go.Tools.Extensions
Assembly: SnapLinkReshapingAvalonia.dll
Syntax
public class SnapLinkReshapingTool : LinkReshapingTool
Remarks

If AvoidsNodes is true and the link is orthogonal, it also avoids reshaping the link so that any adjacent segments cross over any avoidable nodes.

Properties

AvoidsNodes

Gets or sets whether a reshape handle's position should only be dragged where the adjacent segments do not cross over any nodes. This affects the behavior of ComputeReshape(Point).

Declaration
public bool AvoidsNodes { get; set; }
Property Value
Type Description
bool
Remarks

The default value is true.

GridCellSize

Gets or sets the Size of each grid cell to which link points will be snapped.

Declaration
public Size GridCellSize { get; set; }
Property Value
Type Description
Size
Remarks

The default value is NaNxNaN, which means use the Grid's GridCellSize.

GridOrigin

Gets or sets the Point origin for the grid to which link points will be snapped.

Declaration
public Point GridOrigin { get; set; }
Property Value
Type Description
Point
Remarks

The default value is NaNxNaN, which means use the Grid's GridOrigin.

IsGridSnapEnabled

Gets or sets whether a reshape handle's position should be snapped to a grid point. This affects the behavior of ComputeReshape(Point).

Declaration
public bool IsGridSnapEnabled { get; set; }
Property Value
Type Description
bool
Remarks

The default value is true.

Methods

ComputeReshape(Point)

Pretend while dragging a reshape handle the mouse point is at the nearest grid point, if IsGridSnapEnabled is true.

Declaration
public override Point ComputeReshape(Point p)
Parameters
Type Name Description
Point p
Returns
Type Description
Point
Overrides
Remarks

This uses GridCellSize and GridOrigin, unless those are not real values, in which case this uses the Grid"s GridCellSize and GridOrigin.

If AvoidsNodes is true and the adorned Link is IsOrthogonal, this method also avoids returning a Point that causes the adjacent segments, both before and after the current handle's index, to cross over any Nodes that are Avoidable.

DoActivate()

This override records information about the original point of the handle being dragged, if the AdornedLink is Orthogonal and if AvoidsNodes is true.

Declaration
public override void DoActivate()
Overrides