ResizingTool class

The ResizingTool is used to interactively change the size of a GraphObject in the selected Part or Node by setting its GraphObject#desiredSize property. You may want to save the size to the model by using a TwoWay Binding on the "desiredSize" property of the GraphObject that is named by Part#resizeObjectName. This tool does not operate on Links.

You can limit the permitted minimum and maximum dimensions by setting #minSize and #maxSize. The resizing will also respect the GraphObject#minSize and GraphObject#maxSize properties. Width or height values that are NaN do not constrain the resizing. Override #computeMinSize and/or #computeMaxSize to change this behavior.

You can also limit the width and/or height to be multiples of a particular size by setting Part#resizeCellSize. If either or both of these values are NaN, as they are by default, it will get the values from this tool's #cellSize. Finally it will consider the Diagram#grid's Panel#gridCellSize if #isGridSnapEnabled is true. Override #computeCellSize to change this behavior.

Pressing the Shift key or resizing a Shape with a Shape#geometryStretch of GraphObject.Uniform will maintain the aspect ratio during the resize. Override #computeReshape to change this behavior.

This tool makes use of an Adornment, shown when the Part or Node is selected, that includes some number of resize handles. The resize handles are normally copies of ResizingTool#handleArchetype, unless you specify a custom resize Adornment by setting Part#resizeAdornmentTemplate. The resize Adornment is normally a "Spot" Panel with eight resize handles, each with GraphObject#alignment set to one of the eight standard Spot values -- the four corners and the four side middles. The GraphObject#alignment is what identifies and distinguishes each of the handles and the behavior when the user drags the handle.

This tool conducts a transaction while the tool is active. A successful resizing will result in a "PartResized" DiagramEvent and a "Resizing" transaction.

For a general discussion of the sizing of objects, see: Introduction to the sizing of GraphObjects. For customizing the ResizingTool, see Introduction to the ResizingTool.

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

  var node = ...;
  myDiagram.select(node);
  var adorn = node.findAdornment("Resizing");
  var tool = myDiagram.toolManager.resizingTool;
  // specify which resize handle of the "Resizing" Adornment of the selected node
  tool.handle = adorn.elt(...);
  myDiagram.currentTool = tool;  // starts the ResizingTool
  tool.doActivate();             // activates the ResizingTool
Implemented types
Available Extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

ResizingTool()
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