Interface for a handle that represents a draggable, point-like structure.
Remarks
Typical use cases for handles are draggable items that are only represented by a location, e.g., ports, bends, or reshape handles.
The visual appearance of a handle is implemented by the handlesRenderer. The renderer defaults to applying the yfiles-handle-template
CSS class for the base visual templates for handles (and specific template classes for specific handle types), and the yfiles-handle
CSS class for every rendered handle. Additionally, resize handles have one or two of the following classes depending on their location: yfiles-handle-top
, yfiles-handle-right
, yfiles-handle-bottom
, yfiles-handle-left
.
The HandleInputMode manages visualization and interaction with IHandles. A drag on the handle will trigger the invocation of initializeDrag, zero or more handleMove calls, and will be finalized by either dragFinished or cancelDrag.
IHandle implementations are added to the CanvasComponent by providing them through IHandleProvider, IReshapeHandleProvider, or more general through the ILookup mechanism. The GraphEditorInputMode queries the different providers and passes the handles to its HandleInputMode.
Related Reading in the Developer's Guide
Related Programming Samples
- Reshape Handle Provider Configuration
- Shows how resizing of nodes can be customized.
- Reshape Handle Provider
- Shows how to add resize handles to ports.
Type Details
- yFiles module
- view
See Also
Properties
Gets the cursor to display when the mouse hovers over or drags this handle.
Gets a view of the location of the item.
Remarks
Defined in
Gets an optional tag object associated with the handle.
Remarks
Gets the type of the handle that can be used by the rendering engine to render types differently.
Methods
Called by clients to indicate that the dragging has been canceled by the user.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to retrieve information about the drag from.
- originalLocation - Point
- The value of the coordinate of the location property at the time of initializeDrag.
Defined in
Called by clients to indicate that the repositioning has just been finished.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to retrieve information about the drag from.
- originalLocation - Point
- The value of the location property at the time of initializeDrag.
- newLocation - Point
- The coordinates in the world coordinate system that the client wants the handle to be at. Depending on the implementation the location may or may not be modified to reflect the new value. This is the same value as delivered in the last invocation of handleMove.
Defined in
Called to indicate that the handle has been clicked or tapped by the user.
Remarks
This method is called by HandleInputMode when clickRecognizer or clickRecognizerTouch is triggered.
Changing the cursor or type of the clicked handle will instantly be considered by the HandleInputMode but handles won't be re-queried automatically. If, for example, different handles should be used as a result of the click, requeryHandles has to be called.
Parameters
A map of options to pass to the method.
- evt - ClickEventArgs
- Arguments describing the click.
Called by clients to indicate that the element has been dragged and its position should be updated.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to retrieve information about the drag from.
- originalLocation - Point
- The value of the location property at the time of initializeDrag.
- newLocation - Point
- The coordinates in the world coordinate system that the client wants the handle to be at. Depending on the implementation, the location may or may not be modified to reflect the new value.
Defined in
Called by clients to indicate that the element is going to be dragged.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to retrieve information about the drag from.
Defined in
Static Methods
Parameters
A map of options to pass to the method.
- handleClick - function(ClickEventArgs):void
Called to indicate that the handle has been clicked or tapped by the user.
This property holds the implementation for handleClick.
- initializeDrag - function(IInputModeContext):void
Called by clients to indicate that the element is going to be dragged.
This property holds the implementation for initializeDrag.
- handleMove - function(IInputModeContext, Point, Point):void
Called by clients to indicate that the element has been dragged and its position should be updated.
This property holds the implementation for handleMove.
- cancelDrag - function(IInputModeContext, Point):void
Called by clients to indicate that the dragging has been canceled by the user.
This property holds the implementation for cancelDrag.
- dragFinished - function(IInputModeContext, Point, Point):void
Called by clients to indicate that the repositioning has just been finished.
This property holds the implementation for dragFinished.
- type - HandleType
Gets the type of the handle that can be used by the rendering engine to render types differently.
This property holds the implementation for type.
- tag - any
Gets an optional tag object associated with the handle.
This property holds the implementation for tag.
- cursor - Cursor
Gets the cursor to display when the mouse hovers over or drags this handle.
This property holds the implementation for cursor.
- location - IPoint
Gets a view of the location of the item.
This property holds the implementation for location.