Class LinkLabelOnPathDraggingTool

GoDiagram®
v10.0.12
by Northwoods Software®

The LinkLabelOnPathDraggingTool class lets the user move a label on a Link while keeping the label on the link's path.

Inheritance
LinkLabelOnPathDraggingTool
Namespace: Northwoods.Go.Tools.Extensions
Assembly: LinkLabelOnPathDraggingAvalonia.dll
Syntax
public class LinkLabelOnPathDraggingTool : Tool
Remarks

This tool only works when the Link has a label marked by the "_IsLinkLabel" property.

Constructors

LinkLabelOnPathDraggingTool()

Constructs a LinkLabelOnPathDraggingTool and sets the name for the tool.

Declaration
public LinkLabelOnPathDraggingTool()

Fields

Label

The label being dragged.

Declaration
public GraphObject Label
Field Value
Type Description
GraphObject

Methods

CanStart()

This tool can only start if the mouse has moved enough so that it is not a click, and if the mouse down point is on a GraphObject "label" in a Link Panel, as determined by FindLabel().

Declaration
public override bool CanStart()
Returns
Type Description
bool
Overrides

DoActivate()

Start a transaction, call FindLabel and remember it as the Label property, and remember the original value for the label's SegmentFraction property.

Declaration
public override void DoActivate()
Overrides

DoCancel()

Restore the label's original value for SegmentFraction property.

Declaration
public override void DoCancel()
Overrides

DoDeactivate()

Stop any ongoing transaction.

Declaration
public override void DoDeactivate()
Overrides

DoMouseMove()

During the drag, call UpdateSegmentOffset() in order to set the SegmentFraction property of the label.

Declaration
public override void DoMouseMove()
Overrides

DoMouseUp()

At the end of the drag, update the segment properties of the label and finish the tool, completing a transaction.

Declaration
public override void DoMouseUp()
Overrides

DoStop()

Clear any reference to a label element.

Declaration
public override void DoStop()
Overrides

FindLabel()

From the GraphObject at the mouse point, search up the visual tree until we get to an object that has the "_IsLinkLabel" property set to true and that is an immediate child of a Link Panel.

Declaration
public GraphObject FindLabel()
Returns
Type Description
GraphObject

This returns null if no such label is at the mouse down point.

UpdateSegmentOffset()

Save the label's SegmentFraction at the closest point to the mouse.

Declaration
public void UpdateSegmentOffset()