Options
Public/Protected
  • Public
  • Public/Protected
  • All
Menu

GoJS API 文档

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. Extensions can be found in the GoJS kit under the extensions or extensionsTS folders. See the Extensions intro page for more information.

Hierarchy

  • Tool
    • LinkLabelOnPathDraggingTool

The LinkLabelOnPathDraggingTool class lets the user move a label on a Link while keeping the label on the link's path. This tool only works when the Link has a label marked by the "_isLinkLabel" property.

If you want to experiment with this extension, try the Link Label On Path Dragging sample.

Index

Constructors

constructor

Properties

label : GraphObject | null

The label being dragged.

Methods

Override canStart

  • canStart(): boolean
  • 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.

    Returns boolean

Override doActivate

  • doActivate(): void
  • Start a transaction, call findLabel and remember it as the "label" property, and remember the original values for the label's segment properties.

    Returns void

Override doCancel

  • doCancel(): void
  • Restore the label's original value for GraphObject.segment... properties.

    Returns void

Override doDeactivate

  • doDeactivate(): void
  • Stop any ongoing transaction.

    Returns void

Override doMouseMove

  • doMouseMove(): void
  • During the drag, call updateSegmentOffset in order to set the segment... properties of the label.

    Returns void

Override doMouseUp

  • doMouseUp(): void
  • At the end of the drag, update the segment properties of the label and finish the tool, completing a transaction.

    Returns void

Override doStop

  • doStop(): void
  • Clear any reference to a label element.

    Returns void

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.

    Returns GraphObject | null

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

updateSegmentOffset

  • updateSegmentOffset(): void
加入 GoJS 交流群
GoJS 交流群 (769862113)