Class NodeLabelDraggingTool

GoDiagram®
v10.0.11
by Northwoods Software®

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

Inheritance
NodeLabelDraggingTool
Namespace: Northwoods.Go.Tools.Extensions
Assembly: NodeLabelDraggingAvalonia.dll
Syntax
public class NodeLabelDraggingTool : Tool
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.

Declaration
public NodeLabelDraggingTool()

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 Spot 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 Alignment property.

Declaration
public override void DoActivate()
Overrides

DoCancel()

Restore the label's original value for Alignment.

Declaration
public override void DoCancel()
Overrides

DoDeactivate()

Stop any ongoing transaction.

Declaration
public override void DoDeactivate()
Overrides

DoMouseMove()

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

Declaration
public override void DoMouseMove()
Overrides

DoMouseUp()

At the end of the drag, update the alignment 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 "_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).

Declaration
public GraphObject FindLabel()
Returns
Type Description
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.

Declaration
public void UpdateAlignment()