An IInputMode that can be used to drag a ILabel in a GraphComponent.
Remarks
This implementation shows the possible candidate positions for a given label and allows the user to drag the label to one of these positions.
Note that the positionHandler property is not used by this instance. Developers who want to set their own IPositionHandler implementations have to either decorate the label's ILookup or override createLabelPositionHandler.
Examples
MoveLabelInputMode
is installed as child mode of a GraphEditorInputMode and can be retrieved from the moveLabelInputMode property.Type Details
- yfiles module
- view-editor
- yfiles-umd modules
- view-editor, view-table, view
- Legacy UMD name
- yfiles.input.MoveLabelInputMode
See Also
Constructors
Creates a new instance that will move labels in the graph retrieved from the inputModeContext.
Parameters
A map of options to pass to the method.
- allowUnselected - boolean
A property that determines whether or not moving unselected labels is allowed. This option sets the allowUnselected property on the created object.
- useLabelModelParameterFinder - boolean
A value indicating whether or not using the ILabelModelParameterFinder to assign new label model parameters is allowed. This option sets the useLabelModelParameterFinder property on the created object.
- visualization - Visualization
How the moved label should be shown during the gesture. This option sets the visualization property on the created object.
- enabled - boolean
The enabled state of this input mode. This option sets the enabled property on the created object.
- priority - number
- exclusive - boolean
A value indicating whether this mode will be the only one running when it has the mutex. This option sets the exclusive property on the created object.
- disableSnappingRecognizer - function(Object, EventArgs):boolean
The event recognizer that determines whether to temporarily disable snapping. This option sets the disableSnappingRecognizer property on the created object.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
- enableSnappingRecognizer - function(Object, EventArgs):boolean
The event recognizer that determines whether to reenable temporarily disabled snapping. This option sets the enableSnappingRecognizer property on the created object.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
- pressedRecognizer - function(Object, EventArgs):boolean
The event recognizer that determines whether to start moving the selection. This option sets the pressedRecognizer property on the created object.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
- hoverRecognizer - function(Object, EventArgs):boolean
The event recognizer that determines whether to the user is hovering over an item where pressing can initialize a move operation. This option sets the hoverRecognizer property on the created object.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
- draggedRecognizer - function(Object, EventArgs):boolean
The event recognizer that determines whether to move the selection. This option sets the draggedRecognizer property on the created object.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
- cancelRecognizer - function(Object, EventArgs):boolean
The event recognizer that determines whether to cancel the move. This option sets the cancelRecognizer property on the created object.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
- releasedRecognizer - function(Object, EventArgs):boolean
The event recognizer that determines whether to finish moving the selection. This option sets the releasedRecognizer property on the created object.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
- pressedRecognizerTouch - function(Object, EventArgs):boolean
The event recognizer that determines whether to start moving the selection via touch. This option sets the pressedRecognizerTouch property on the created object.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
- draggedRecognizerTouch - function(Object, EventArgs):boolean
The event recognizer that determines whether to move the selection via touch. This option sets the draggedRecognizerTouch property on the created object.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
- releasedRecognizerTouch - function(Object, EventArgs):boolean
The event recognizer that determines whether to finish moving the selection via touch. This option sets the releasedRecognizerTouch property on the created object.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
A callback that recognizes events.Given a sender and an event argument, delegates decide whether the event is treated as a match depending on the context.Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
- hitTestable - IHitTestable
The IHitTestable that will be used by this mode to determine where the user may start dragging. This option sets the hitTestable property on the created object.
- positionHandler - IPositionHandler
The IPositionHandler that will be used as fallback to handle that actual movement of the elements during the drag. This option sets the positionHandler property on the created object.
- validBeginCursor - Cursor
The cursor to use while hovering above items that may be moved. This option sets the validBeginCursor property on the created object.
- moveCursor - Cursor
The cursor to use while moving items. This option sets the moveCursor property on the created object.
- snapContext - SnapContext
The snapContext which manages snapping model items to certain coordinates (for instance, other items). This option sets the snapContext property on the created object.
See Also
Properties
Gets an immutable snapshot of the IModelItems affected by the currently active gesture.
Remarks
When the gesture is starting and the positionHandler is initialized, the implementation can register the affected item(s) through the IModelItemCollector instance that is bound to the context available via its lookup.
Client code can register with the DragStarted event, as well as the DragFinished event to get notified of the elements that may be or have been affected respectively by this input mode.
Examples
mode.moveInputMode.addDragFinishedListener((sender, args) => {
for (const item of mode.moveInputMode.affectedItems) {
// these items have been moved
}
})
See Also
Defined in
Gets or sets the event recognizer that determines whether to cancel the move.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Defined in
Gets the installed controller.
Defined in
Gets or sets the event recognizer that determines whether to temporarily disable snapping.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
See Also
Defined in
Gets or sets the event recognizer that determines whether to move the selection.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Defined in
Gets or sets the event recognizer that determines whether to move the selection via touch.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Defined in
Gets or sets the enabled state of this input mode.
Remarks
Examples
Defined in
Gets or sets the event recognizer that determines whether to reenable temporarily disabled snapping.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Defined in
Gets or sets a value indicating whether this mode will be the only one running when it has the mutex.
Remarks
The value of this property will be delegated to the exclusive property of the controller.
If this mode is marked as exclusive and has the mutex, all other modes added to the same MultiplexingInputMode will be deactivated. Otherwise it will always run concurrently with all other modes.
Defined in
Gets the IGraphSelection this mode is acting upon.
Gets or sets the IHitTestable that will be used by this mode to determine where the user may start dragging.
Gets or sets the event recognizer that determines whether to the user is hovering over an item where pressing can initialize a move operation.
Remarks
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Defined in
Gets the initial position where the dragging was initiated.
Defined in
Gets the context instance this mode is currently installed in or null
if this instance is not installed.
Remarks
Implements
Gets a value indicating whether a drag operation is currently in progress.
Defined in
Gets or sets the cursor to use while moving items.
Gets the label that is currently moved or null
if there is no such label.
Remarks
null
only if this mode is currently active and performs a move operation, that is between the DragStarting and the DragFinished event handlers.See Also
Gets or sets the IPositionHandler that will be used as fallback to handle that actual movement of the elements during the drag.
Remarks
See Also
Defined in
Gets or sets the event recognizer that determines whether to start moving the selection.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
See Also
Defined in
Gets or sets the event recognizer that determines whether to start moving the selection via touch.
Remarks
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
See Also
Defined in
Gets the priority of this input mode.
Remarks
See Also
Implements
Gets or sets the event recognizer that determines whether to finish moving the selection.
Remarks
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Defined in
Gets or sets the event recognizer that determines whether to finish moving the selection via touch.
Signature Details
function(eventSource: any, evt: EventArgs) : boolean
Parameters
- eventSource - any
- The source of the event.
- evt - EventArgs
- The arguments of the event to be decided to handle.
Returns
- boolean
true
if theevt
is considered to be handled.
Defined in
Gets or sets the snapContext which manages snapping model items to certain coordinates (for instance, other items).
Remarks
If set to null
(the default) this input mode tries to obtain the snapContext from the IInputModeContext. To explicitly disable snapping, a snapContext implementation that does nothing has to be set to this instance.
Default is null
.
Defined in
Gets or sets a value indicating whether or not using the ILabelModelParameterFinder to assign new label model parameters is allowed.
Remarks
The default is true
This property has no effect if an IPositionHandler is available in the label's lookup.
See Also
Gets or sets the cursor to use while hovering above items that may be moved.
Gets or sets how the moved label should be shown during the gesture.
Remarks
Changing this property during a gesture will have no effect.
Default is DUMMY.
This property has no effect if an IPositionHandler is available in the label's lookup.
Methods
Called when this mode is "armed".
Remarks
Defined in
Cancels the editing of this mode.
Remarks
See Also
Implements
Creates the position handler for the given label used in isValidLabelHit.
Remarks
Parameters
A map of options to pass to the method.
- label - ILabel
- The label to create a position handler for.
Returns
- ↪IPositionHandler
- A position handler for the given label.
Creates an IInputModeContext for use with the IPositionHandler interface for the upcoming drag operation.
Called when this mode is "disarmed".
Remarks
Defined in
Simulates the start of a drag and puts the state machine into the dragging state.
Remarks
location
.Parameters
A map of options to pass to the method.
- location - Point
- The location where the drag had been initialized.
Returns
- ↪Promise<IEnumerable<IModelItem>>
- A task that represents the asynchronous drag operation. The result of the task contains the affected items or
null
if the drag was canceled.
Defined in
Looks for a label that has been hit at the specified position.
Remarks
If moving unselected labels are allowed, this implementation enumerates the labels at the given location
. The first label where shouldMove returns true
is returned. If there is no such label, null
is returned.
If only selected labels can be moved, this implementation checks the graphSelection to see if there is exactly one selected label. This label is returned if it is hit by the mouse and shouldMove returns true
. Otherwise, null
is returned.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context for the hit test.
- location - Point
- The coordinates for the hit test.
Returns
- ↪ILabel
- The label hit at the given location or
null
.
See Also
Installs this mode into the given context that is provided by the canvas.
Remarks
In general a mode can only be installed into a single canvas at all times.
This method is called to initialize this instance. Subclasses should override this method to register the corresponding event handler delegates for the various input events they need to register with.
Overriding implementations should call the base implementation, first.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context that this instance shall be installed into. The same instance will be passed to this instance during uninstall. A reference to the context may be kept and queried during the time the mode is installed.
- controller - ConcurrencyController
- The controller for this mode.
See Also
Implements
Determines whether or not a valid label has been hit at the specified position.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context for the hit test.
- location - Point
- The coordinates for the hit test.
Returns
- ↪boolean
true
if a valid label is hit and the label moving should be started here. Otherwise,false
.
Determines whether the given location is a valid start location for the move gesture.
Remarks
Parameters
A map of options to pass to the method.
- location - Point
- The location in the world coordinate system.
Returns
- ↪boolean
true
if at the given location it is valid to start the move gesture; otherwise,false
.
Defined in
Called after cancel has been called.
Remarks
Can be overridden in subclasses to perform additional actions after the mode has been canceled.
This implementation does nothing.
Defined in
Called after the active property of the installed ConcurrencyController has been set to true
.
Remarks
Can be overridden in subclasses to perform additional actions after the mode has been activated.
Overriding implementations should call the base implementation.
Defined in
Called after the active property of the installed ConcurrencyController has been set to false
.
Remarks
Can be overridden in subclasses to perform additional actions after the mode has been deactivated.
Overriding implementations should call the base implementation.
Defined in
Clears the positionHandler property.
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event argument that contains context information.
Overrides
Triggers the DragCanceling event.
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event argument that contains context information.
Defined in
Clears the positionHandler property.
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event argument that contains context information.
Overrides
Called before the drag will be finalized.
Remarks
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event argument that contains context information.
Defined in
Called at the end of each drag.
Remarks
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event argument that contains context information.
Defined in
Called at the start of each drag.
Remarks
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event argument that contains context information.
Defined in
Triggers the DragStarted event.
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event argument that contains context information.
Defined in
Registers the positionHandler created during the last createLabelPositionHandler call.
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event argument that contains context information.
Overrides
Raises the QueryPositionHandler event.
Parameters
A map of options to pass to the method.
- evt - QueryPositionHandlerEventArgs
- The QueryPositionHandlerEventArgs instance containing the event data.
Defined in
Called after tryStop has been called.
Remarks
Can be overridden in subclasses to perform additional actions after the mode has been stopped.
This implementation does nothing.
Defined in
Determines whether or not a label is allowed to be moved.
Remarks
false
if the parent input mode forbids moving the label. Overriding implementations should query this implementation as base if this feature is desired.Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context.
- label - ILabel
- The label to be checked.
Returns
- ↪boolean
true
if the label is allowed to move.
See Also
Called by the client in order to stop a current editing progress.
Remarks
false
Returns
- ↪boolean
true
if and only if the editing has been stopped or there was no edit in progress
See Also
Implements
Uninstalls this mode from the given context.
Remarks
This code should clean up all changes made to the canvas in the install method. After a mode has been uninstalled it can be installed again into the same or another canvas.
Overriding implementations should call the base implementation after their own code.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to deregister from. This is the same instance that had been passed to install during installation.
Implements
Events
Occurs when the drag has been canceled.
See Also
Defined in
Event Registration
addDragCanceledListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDragCanceledListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
Occurs before the drag will be canceled.
See Also
Defined in
Event Registration
addDragCancelingListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDragCancelingListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
Occurs once the drag has been finished.
Examples
mode.moveInputMode.addDragFinishedListener((sender, args) => {
for (const item of mode.moveInputMode.affectedItems) {
// these items have been moved
}
})
See Also
Defined in
Event Registration
addDragFinishedListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDragFinishedListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
Occurs before the drag will be finished.
See Also
Defined in
Event Registration
addDragFinishingListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDragFinishingListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
Occurs at the end of every drag.
See Also
Defined in
Event Registration
addDraggedListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDraggedListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
Occurs at the start of every drag.
See Also
Defined in
Event Registration
addDraggingListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDraggingListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
Occurs once the drag is initialized and has started.
See Also
Defined in
Event Registration
addDragStartedListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDragStartedListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
Occurs once the drag is starting.
See Also
Defined in
Event Registration
addDragStartingListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDragStartingListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
Occurs when a drag is recognized for the MoveInputMode.
Remarks
See Also
Defined in
Event Registration
addQueryPositionHandlerListener(function(this, QueryPositionHandlerEventArgs):void)
Event Deregistration
removeQueryPositionHandlerListener(function(this, QueryPositionHandlerEventArgs):void)
Signature Details
function(sender: this, evt: QueryPositionHandlerEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - QueryPositionHandlerEventArgs
- An object that contains the event data.