Interface used for implementations that recognize, approve, and disapprove node reparenting gestures, as well as actually perform the reparenting.
Remarks
If possible, it's recommended to rather inherit class ReparentNodeHandler as it provides more convenience for determining whether a gesture is a reparent gesture.
Implementations of this interface are meant to be registered at the reparentNodeHandler property and are queried from the IInputModeContext by code that wants to reparent a node. Specifically, this is used by default to reparent nodes during the dragging of nodes.
During a drag gesture this interface is queried if the gesture is generally a reparent gesture, the user may detach the dragged node from its current parent and if a potential new parent is valid.
Related Programming Samples
- Reparent Handler
- Shows how reparenting of nodes can be customized.
Type Details
- yFiles module
- view
Methods
Determines whether the current user input that can be determined through the context is a reparent gesture.
Remarks
true.Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context that provides information about the user input.
- node - INode
- The node that will possibly be reparented. May be irrelevant for the result.
Returns
- ↪boolean
- Whether this is a reparenting gesture.
Determines whether the provided node may be reparented to this potential newParent.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context that provides information about the user input.
- node - INode
- The node that will be reparented.
- newParent - INode
- The potential new parent or
nullfor the root (no parent). Can be a group or a non-group node.
Returns
- ↪boolean
- Whether
newParentis a valid new parent fornode.
Performs the actual reparenting after the reparent gesture has been finalized.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context that provides information about the user input.
- node - INode
- The node that will be reparented.
- newParent - INode
- The potential new parent or
nullfor the root (no parent). Can be a group or a non-group node.
Determines whether the user may detach the given node from its current parent in order to reparent it.
Remarks
true.Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context that provides information about the user input.
- node - INode
- The node that is about to be detached from its current parent.
Returns
- ↪boolean
- Whether the node may be detached and reparented.
Static Methods
Parameters
A map of options to pass to the method.
- isReparentGesture - function(IInputModeContext, INode):boolean
Determines whether the current user input that can be determined through the context is a reparent gesture.
This property holds the implementation for isReparentGesture.
- shouldReparent - function(IInputModeContext, INode):boolean
Determines whether the user may detach the given node from its current parent in order to reparent it.
This property holds the implementation for shouldReparent.
- isValidParent - function(IInputModeContext, INode, INode):boolean
Determines whether the provided node may be reparented to this potential
newParent.This property holds the implementation for isValidParent.
- reparent - function(IInputModeContext, INode, INode):void
Performs the actual reparenting after the reparent gesture has been finalized.
This property holds the implementation for reparent.