This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. See the Extensions intro page for more information.
Constructs a NodeLabelDraggingTool and sets the name for the tool.
Optional
init: Partial<NodeLabelDraggingTool>Override
canOverride
doStart a transaction, call findLabel and remember it as the "label" property, and remember the original value for the label's go.GraphObject.alignment property.
Override
doOverride
doOverride
doDuring the drag, call updateAlignment in order to set the go.GraphObject.alignment of the label.
Override
doOverride
doFrom 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).
This returns null if no such label is at the mouse down point.
Save the label's go.GraphObject.alignment as an absolute offset from the center of the Spot Panel that the label is in.
The label being dragged.
The NodeLabelDraggingTool class lets the user move a label on a Node.
This tool only works when the Node has a label (any GraphObject) marked with
{ _isNodeLabel: true }
that is positioned in a Spot Panel. It works by modifying that label's go.GraphObject.alignment property to have an offset from the center of the panel.If you want to experiment with this extension, try the Node Label Dragging sample.