Class LinkLabelDraggingTool

GoDiagram®
v10.0.11
by Northwoods Software®

The LinkLabelDraggingTool class lets the user move a label on a Link.

Inheritance
LinkLabelDraggingTool
Namespace: Northwoods.Go.Tools.Extensions
Assembly: LinkLabelDraggingAvalonia.dll
Syntax
public class LinkLabelDraggingTool : Tool
Remarks

This tool only works when the Link has a label that is positioned at the MidPoint plus some offset. It does not work for labels that have a particular SegmentIndex.

Constructors

LinkLabelDraggingTool()

Constructs a LinkLabelDraggingTool and sets the name for the tool.

Declaration
public LinkLabelDraggingTool()

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 SegmentOffset property.

Declaration
public override void DoActivate()
Overrides

DoCancel()

Restore the label's original value for SegmentOffset.

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 SegmentOffset of the label.

Declaration
public override void DoMouseMove()
Overrides

DoMouseUp()

At the end of the drag, update the segment offset 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 is a label of a Link.

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 SegmentOffset as a rotated offset from the midpoint of the Link that the label is in.

Declaration
public void UpdateSegmentOffset()