Table of Contents

Class NodeLabelDraggingTool

Namespace
Northwoods.Go.Tools.Extensions
Assembly
NodeLabelDraggingWinForms.dll

The NodeLabelDraggingTool class lets the user move a label on a Node.

public class NodeLabelDraggingTool : Tool
Inheritance
NodeLabelDraggingTool
Inherited Members

Remarks

This tool only works when the Node has a label (any GraphObject) marked by the "_IsNodeLabel" property that is positioned in a Spot Panel. It works by modifying that label's Alignment property to have an offset from the center of the panel.

Constructors

NodeLabelDraggingTool()

Constructs a NodeLabelDraggingTool and sets the name for the tool.

public NodeLabelDraggingTool()

Fields

Label

The label being dragged.

public GraphObject Label

Field Value

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 Spot Panel, as determined by FindLabel().

public override bool CanStart()

Returns

bool

DoActivate()

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

public override void DoActivate()

DoCancel()

Restore the label's original value for Alignment.

public override void DoCancel()

DoDeactivate()

Stop any ongoing transaction.

public override void DoDeactivate()

DoMouseMove()

During the drag, call UpdateAlignment() in order to set the Alignment of the label.

public override void DoMouseMove()

DoMouseUp()

At the end of the drag, update the alignment 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 "_IsNodeLabel" property set to true, that is in a Spot Panel, and that is not the first element of that Panel (i.e. not the main element of the panel).

public GraphObject FindLabel()

Returns

GraphObject

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

UpdateAlignment()

Save the label's Alignment as an absolute offset from the center of the Spot Panel that the label is in.

public void UpdateAlignment()