LinkReshapingTool class
The LinkReshapingTool is used to interactively change the route of a Link by setting its Link#points list. You may want to save the route to the model by using a TwoWay Binding on the "points" property of the Link.
This tool makes use of an Adornment, shown when the adorned Link is selected, that includes some number of reshape handles. This tool conducts a transaction while the tool is active. A successful reshaping will result in a "LinkReshaped" DiagramEvent and a "LinkReshaping" transaction.
For a general discussion of link routing, see: Introduction to Links, Introduction to Link Labels, and Introduction to Link Connection Points. For customizing the linking tools, see Introduction to the Linking Tools. For a general discussion of validation, see Introduction to Validation.
- Implemented types
- Available extensions
- Annotations
-
- @JS()
- @staticInterop
Constructors
- LinkReshapingTool()
-
factory
Properties
- adornedLink ↔ Link?
-
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
This read-only property returns the Link that is being routed manually.getter/setter pair - diagram ↔ Diagram
-
Available on Tool, provided by the Tool$Typings extension
This read-only property returns the Diagram that owns this tool and for which this tool is handling input events.getter/setter pair - handle ↔ GraphObject?
-
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Returns the GraphObject that is the tool handle being dragged by the user. This will be contained by an Adornment whose category is "LinkReshaping". Its Adornment#adornedPart is the same as the #adornedLink. This is normally set by #doActivate, remembering the result of the call to Tool#findToolHandleAt.getter/setter pair - handleArchetype ↔ GraphObject?
-
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Gets or sets a small GraphObject that is copied as a reshape handle at each movable point in the selected link's route. By default this is a Shape that is a small blue rectangle. Setting this property does not raise any events.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- isActive ↔ bool
-
Available on Tool, provided by the Tool$Typings extension
Gets or sets whether this tool is started and is actively doing something.getter/setter pair - isEnabled ↔ bool
-
Available on Tool, provided by the Tool$Typings extension
Gets or sets whether this tool can be started by a mouse event.getter/setter pair - midHandleArchetype ↔ GraphObject?
-
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Gets or sets a small GraphObject that is copied as a resegment handle at each mid-point in the selected Link's route. By default this is a Shape that is a small blue diamond. Setting this property does not raise any events.getter/setter pair - name ↔ String
-
Available on Tool, provided by the Tool$Typings extension
Gets or sets the name of this tool. The default name is an empty string, but the constructor for each instance of a subclass of Tool will initialize it appropriately. For example, the name of the DragSelectingTool is "DragSelecting".getter/setter pair - originalPoint ↔ Point
-
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
This read-only property returns the Point that was the original location of the handle that is being dragged to reshape the Link.getter/setter pair -
originalPoints
↔ List<
Point> -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
This read-only property returns the List of Points that was the original route of the Link that is being reshaped. This List should not be modified; its value is indeterminate until a reshaping has been activated.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transactionResult ↔ String?
-
Available on Tool, provided by the Tool$Typings extension
Gets or sets the name of the transaction to be committed by #stopTransactiongetter/setter pair
Methods
-
cancelWaitAfter(
) → void -
Available on Tool, provided by the Tool$Typings extension
This is called to cancel any running "WaitAfter" timer. -
canStart(
) → bool -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
This tool may run when there is a mouse-down event on a reshape handle. -
canStart(
) → bool -
Available on Tool, provided by the Tool$Typings extension
This predicate is used by the ToolManager to decide if this tool can be started mode-lessly by mouse and touch events. Implementations of this method can look at Diagram#lastInput to get the mouse event and input state. -
canStartMultiTouch(
) → bool -
Available on Tool, provided by the Tool$Typings extension
Called by ToolManager#doMouseDown and ToolManager#doMouseMove, this method determines whether or not to allow pinch zooming from a multi-touch event. By default this predicate just returns true. This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method. @expose @return {boolean} @see #standardPinchZoomStart @see #standardPinchZoomMove @since 1.5 -
computeReshape(
Point p) → Point -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
This is called by #doMouseMove and #doMouseUp to limit the input point before calling #reshape. -
doActivate(
) → void -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Start reshaping, if #findToolHandleAt finds a reshape handle at the mouse down point. -
doActivate(
) → void -
Available on Tool, provided by the Tool$Typings extension
The Diagram calls this method after setting Diagram#currentTool, to make the new tool active. This should set #isActive to true. Overrides of this method might call #startTransaction, if this tool's activity involves modification of the model. Implementations of this method can look at Diagram#lastInput to get the mouse event and input state. -
doCancel(
) → void -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Restore the link route to be the original points and stop this tool. -
doCancel(
) → void -
Available on Tool, provided by the Tool$Typings extension
The diagram will call this method when the user wishes to cancel the current tool's operation. Typically this is called when the user hits the ESCAPE key. This should restore the original state of what was modified by this tool, and then it should call #stopTool. This method is not responsible for cleaning up any side-effects that should be performed by #doDeactivate and/or #doStop, which will always be called whether the tool stops normally or abnormally. -
doDeactivate(
) → void -
Available on Tool, provided by the Tool$Typings extension
The Diagram calls this method on the old tool when Diagram#currentTool is set to a new tool. This needs to set #isActive to false. Overrides of this method might call #stopTransaction, if this tool's activity involves modification of the model. -
doDeactivate(
) → void -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
This stops the current reshaping operation with the link route shaped the way it is. -
doKeyDown(
) → void -
Available on Tool, provided by the Tool$Typings extension
The diagram will call this method upon a key down event. By default this just calls #doCancel if the key is the ESCAPE key. Implementations of this method can look at Diagram#lastInput to get the key. -
doKeyUp(
) → void -
Available on Tool, provided by the Tool$Typings extension
The diagram will call this method upon a key up event. Implementations of this method can look at Diagram#lastInput to get the key. -
doMouseDown(
) → void -
Available on Tool, provided by the Tool$Typings extension
The diagram will call this method upon a mouse down event. This is normally overridden for mouse-down tools; it is not called for mouse-move or mouse-up tools. However it may also be called when the tool is run in a modal fashion, when code explicitly sets the diagram's Diagram#currentTool. Implementations of this method can look at Diagram#lastInput to get the mouse event and input state. -
doMouseMove(
) → void -
Available on Tool, provided by the Tool$Typings extension
The diagram will call this method upon a mouse move event. This is normally overridden for mouse-move tools; it is not called for mouse-up tools. However it may also be called when the tool is run in a modal fashion, when code explicitly sets the diagram's Diagram#currentTool. An override of this method usually does nothing when #isActive is false. Implementations of this method can look at Diagram#lastInput to get the mouse event and input state. -
doMouseMove(
) → void -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Call #reshape with a new point determined by the mouse to change the route of the #adornedLink. -
doMouseUp(
) → void -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Reshape the route with a point based on the most recent mouse point by calling #reshape, and then raise a "LinkReshaped" DiagramEvent before stopping this tool. -
doMouseUp(
) → void -
Available on Tool, provided by the Tool$Typings extension
The diagram will call this method upon a mouse up event. This is normally overridden for mouse-up tools. An override of this method usually does nothing when #isActive is false, except for calling #stopTool. Tools normally stop upon a mouse up, by calling #stopTool. If you want to handle multiple mouse down-up gestures in one tool activation, you will need to override this method to only stop the tool when you want. Implementations of this method can look at Diagram#lastInput to get the mouse event and input state. -
doMouseWheel(
) → void -
Available on Tool, provided by the Tool$Typings extension
The diagram will call this method as the mouse wheel is rotated. Implementations of this method can look at Diagram#lastInput to get the mouse event and input state. -
doStart(
) → void -
Available on Tool, provided by the Tool$Typings extension
The Diagram calls this method when this tool becomes the current tool; you should not call this method. Tool implementations should perform their per-use initialization here, such as setting up internal data structures, or capturing the mouse. Implementations of this method can look at Diagram#lastInput to get the mouse event and input state. -
doStop(
) → void -
Available on Tool, provided by the Tool$Typings extension
The Diagram calls this method when this tool stops being the current tool; you should not call this method. Tool implementations should perform their per-use cleanup here, such as releasing mouse capture. -
doWaitAfter(
InputEvent event) → void -
Available on Tool, provided by the Tool$Typings extension
This is called a certain delay after a call to #standardWaitAfter if there has not been any call to #cancelWaitAfter. The ToolManager overrides this method in order to implement support for mouse-hover behavior and tooltips. -
findToolHandleAt(
Point p, String category) → GraphObject? -
Available on Tool, provided by the Tool$Typings extension
This convenience function finds the front-most GraphObject that is at a given point and that is an element of an Adornment that is of a given category. The tool handle must be an immediate element of the Adornment, not a GraphObject that is nested within Panels within the Adornment. -
getResegmentingPoint(
) → Point -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
(undocumented) If the handle clicked during activation was a resegment handle, return the point at which to start a new segment. By default this returns the center of the handle that was clicked. Please read the Introduction page on Extensions for how to override methods and how to call this base method. -
getReshapingBehavior(
GraphObject obj) → EnumValue -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Get the permitted reshaping behavior for a particular reshape handle. -
isBeyondDragSize(
[Point? first, Point? last]) → bool -
Available on Tool, provided by the Tool$Typings extension
Return true when the last mouse point is far enough away from the first mouse down point to constitute a drag operation instead of just a potential click. -
makeAdornment(
GraphObject pathshape) → Adornment? -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
(undocumented) @expose @param {GraphObject} pathshape @return {Adornment} -
makeHandle(
GraphObject pathshape, num idx) → GraphObject? -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
(undocumented) Create and return a GraphObject that the user can "grab" to relink the selected Link. By default this returns a copy of #handleArchetype, a Shape that is a small blue rectangle. Please read the Introduction page on Extensions for how to override methods and how to call this base method. @expose @param {GraphObject} pathshape the GraphObject path of the link being reshaped. @param {number} idx the index of the route point to be moved. @return {GraphObject} -
makeResegmentHandle(
GraphObject pathshape, num idx) → GraphObject? -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
(undocumented) Create and return a GraphObject that the user can "grab" to add a segment to the selected Link. By default this returns a copy of #midHandleArchetype, a Shape that is a small blue diamond. Please read the Introduction page on Extensions for how to override methods and how to call this base method. @expose @param {GraphObject} pathshape the GraphObject path of the link being reshaped. @param {number} idx the index of the route point to be moved. @return {GraphObject} -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reshape(
Point newPoint) → void -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Change the route of the #adornedLink by moving the point corresponding to the current #handle to be at the given Point. This is called by #doMouseMove and #doMouseUp with the result of calling #computeReshape to constrain the input point. -
setReshapingBehavior(
GraphObject obj, EnumValue behavior) → void -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Set the permitted reshaping behavior for a particular reshape handle. -
standardMouseClick<
T extends GraphObject> ([bool pred(T)?]) → bool -
Available on Tool, provided by the Tool$Typings extension
Implement the standard behavior for mouse clicks, searching for and calling click handler functions on GraphObjects or on Diagram, and raising the corresponding DiagramEvent. -
standardMouseOver(
) → void -
Available on Tool, provided by the Tool$Typings extension
Implement the standard behavior for mouse enter, over, and leave events, where the mouse is moving but no button is pressed. This should be called by mouse move event handlers when wanting to detect and invoke mouse enter/over/leave event handlers. -
standardMouseSelect(
) → void -
Available on Tool, provided by the Tool$Typings extension
Implement the standard behavior for selecting parts with the mouse, depending on the control and shift modifier keys. -
standardMouseWheel(
) → void -
Available on Tool, provided by the Tool$Typings extension
Implement the standard behavior for mouse wheel events. ToolManager#doMouseWheel calls this method. -
standardPinchZoomMove(
) → void -
Available on Tool, provided by the Tool$Typings extension
Continues pinch-zooming (started by #standardPinchZoomStart on multi-touch devices. -
standardPinchZoomStart(
) → void -
Available on Tool, provided by the Tool$Typings extension
Initiates pinch-zooming on multi-touch devices. -
standardWaitAfter(
num delay, [InputEvent? event]) → void -
Available on Tool, provided by the Tool$Typings extension
This is called to start a new timer to call #doWaitAfter after a given delay. It first cancels any previously running "WaitAfter" timer, by calling #cancelWaitAfter. -
startTransaction(
[String? tname]) → bool -
Available on Tool, provided by the Tool$Typings extension
Call Diagram#startTransaction with the given transaction name. This always sets #transactionResult to null. -
stopTool(
) → void -
Available on Tool, provided by the Tool$Typings extension
If the Diagram#currentTool is this tool, stop this tool and start the Diagram#defaultTool by making it be the new current tool. The implementation of various tool methods can call this method to stop the current tool. This will call #doStop -- you should not call that method directly. -
stopTransaction(
) → bool -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
This calls the super Tool#stopTransaction method, and if the result istrue
, attempts to optimize the transaction by removing all changes except the first and last by calling Transaction#optimize. -
stopTransaction(
) → bool -
Available on Tool, provided by the Tool$Typings extension
If #transactionResult is null, call Diagram#rollbackTransaction, otherwise call Diagram#commitTransaction. -
toString(
) → String -
A string representation of this object.
inherited
-
updateAdornments(
Part part) → void -
Available on Tool, provided by the Tool$Typings extension
The diagram asks each tool to update any adornments the tool might use for a given part. If the tool uses its own tool handles, this should display them or hide them as appropriate. Typically this should only show them if the part is selected. -
updateAdornments(
Part part) → void -
Available on LinkReshapingTool, provided by the LinkReshapingTool$Typings extension
Show an Adornment with reshape handles at each of the interesting points of the link's route, if the link is selected and visible and if Part#canReshape is true.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited