Class LinkLabelOnPathDraggingTool
- Namespace
- Northwoods.Go.Tools.Extensions
- Assembly
- LinkLabelOnPathDraggingWinForms.dll
The LinkLabelOnPathDraggingTool class lets the user move a label on a Link while keeping the label on the link's path.
public class LinkLabelOnPathDraggingTool : Tool
- Inheritance
-
LinkLabelOnPathDraggingTool
- Inherited Members
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.
public LinkLabelOnPathDraggingTool()
Fields
Label
The label being dragged.
public GraphObject Label
Field Value
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().
public override bool CanStart()
Returns
DoActivate()
Start a transaction, call FindLabel and remember it as the Label property, and remember the original value for the label's SegmentFraction property.
public override void DoActivate()
DoCancel()
Restore the label's original value for SegmentFraction property.
public override void DoCancel()
DoDeactivate()
Stop any ongoing transaction.
public override void DoDeactivate()
DoMouseMove()
During the drag, call UpdateSegmentOffset() in order to set the SegmentFraction property of the label.
public override void DoMouseMove()
DoMouseUp()
At the end of the drag, update the segment properties of the label and finish the tool, completing a transaction.
public override void DoMouseUp()
DoStop()
Clear any reference to a label element.
public override void DoStop()
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.
public GraphObject FindLabel()
Returns
- 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.
public void UpdateSegmentOffset()