RotatingTool class

The RotatingTool is used to interactively change the GraphObject#angle of a GraphObject by setting its GraphObject#angle property. You may want to save the angle to the model by using a TwoWay Binding on the "angle" property of the GraphObject that is named by Part#rotateObjectName.

This tool allows the user to rotate the Part#rotateObject of the selected Part. The Part must be Part#rotatable, which is false by default. Normally this works with Parts or Nodes; it does not make sense for whole Links or Link#paths, so if you want to rotate a label on a Link, make sure to name that label and refer to it as the Part#rotateObjectName.

You can control the point about which the object is rotated by setting Part#rotationSpot. The rotation spot can be computed dynamically by overriding #computeRotationPoint. The value of that method call is saved as #rotationPoint.

You can limit the permitted angles by setting #snapAngleMultiple and #snapAngleEpsilon. For example, if you want to permit only angles that are multiples of 90 degrees, set #snapAngleMultiple to 90 and #snapAngleEpsilon to 45. Pressing the Shift key during rotation ignores these two properties.

This tool makes use of an Adornment that includes a rotation handle. It is shown when the selected Part is Part#rotatable. You can control its direction relative to the #rotationPoint by setting #handleAngle to a multiple of 90 degrees, and its distance from the rotation point by setting #handleDistance. The rotate handle is normally a copy of RotatingTool#handleArchetype. unless you specify a custom rotate Adornment by setting Part#rotateAdornmentTemplate.

This tool conducts a transaction while the tool is active. A successful rotation will result in a "PartRotated" DiagramEvent and a "Rotating" transaction.

For customizing the RotatingTool, see Introduction to the RotatingTool.

If you want to programmatically start a user's rotating of the Part#rotateObject of an existing selected node, you can set the #handle property to the rotate handle and then start and activate the tool.

  var node = ...;
  myDiagram.select(node);
  var adorn = node.findAdornment("Rotating");
  var tool = myDiagram.toolManager.rotatingTool;
  // specify the rotation handle of the "Rotating" Adornment of the selected node
  tool.handle = adorn.elt(0);
  myDiagram.currentTool = tool;  // starts the RotatingTool
  tool.doActivate();             // activates the RotatingTool
Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

RotatingTool()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited