An input mode which handles drag and drop related events on a CanvasComponent.
Remarks
An instance of DropInputMode is initialized for an expected data type in the constructor. There are four events raised by an instance of this class.
- DragEntered is raised, if a drag operation enters the CanvasComponent.
- DragOver is raised, if a drag operation moves over the CanvasComponent after having entered it.
- DragDropped is raised, if a drag is dropped onto the CanvasComponent.
- DragLeft is raised, if a drag is operation leaves the CanvasComponent.
Clients can query the current mousePosition which is updated while a drag is in progress. Clients get the data from the drag operation by calling dropData from an event handler registered for any of these events.
This mode is exclusive by default.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.input.DropInputMode
See Also
Constructors
Initializes a new instance of the DropInputMode class for the expected data type.
Remarks
Parameters
A map of options to pass to the method.
- expectedType - string
- The type that is used in getData. This may also be a string that contains a comma-separated list of types.
- 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.
- enabled - boolean
The enabled state of this input mode. This option sets the enabled property on the created object.
- dragDropEffect - DragDropEffects
The DragDropEffects that will be used for drags on the canvas. This option sets the dragDropEffect property on the created object.
- validDropHitTestable - IHitTestable
The IHitTestable that determines whether the given location is a valid drop location. This option sets the validDropHitTestable property on the created object.
- captureMouseInputDuringDrag - boolean
A value indicating whether to capture mouse input during drag operations. This option sets the captureMouseInputDuringDrag property on the created object.
See Also
Initializes a new instance of the DropInputMode class for the expected data type.
Remarks
Parameters
A map of options to pass to the method.
- expectedType - string[]
- A list of types that are used in getData.
- 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.
- enabled - boolean
The enabled state of this input mode. This option sets the enabled property on the created object.
- dragDropEffect - DragDropEffects
The DragDropEffects that will be used for drags on the canvas. This option sets the dragDropEffect property on the created object.
- validDropHitTestable - IHitTestable
The IHitTestable that determines whether the given location is a valid drop location. This option sets the validDropHitTestable property on the created object.
- captureMouseInputDuringDrag - boolean
A value indicating whether to capture mouse input during drag operations. This option sets the captureMouseInputDuringDrag property on the created object.
See Also
Properties
Gets the installed controller.
Gets or sets the DragDropEffects that will be used for drags on the canvas.
Gets the data carried by a drag operation.
Remarks
Gets the mouse position after dropping an item.
Remarks
Gets or sets the enabled state of this input mode.
Remarks
Examples
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.
Gets the context instance this mode is currently installed in or null
if this instance is not installed.
Remarks
Implements
Gets the last processed drag event argument.
Gets the current mouse position during drag operations.
Remarks
Gets the priority of this input mode.
Remarks
See Also
Implements
Gets or sets the IHitTestable that determines whether the given location is a valid drop location.
See Also
Methods
Called to adjust the dropEffect accordingly.
Parameters
A map of options to pass to the method.
- evt - DragEventArgs
- The event args of the drag event to adjust the effects for.
Returns
- ↪boolean
true
if the drag event is handled by this input mode.
Cleanly cancels this mode.
Implements
Helper method that yields a suitably configured InputModeEventArgs for this input mode.
Returns
- ↪InputModeEventArgs
- An input mode event argument that is configured for this instance.
Installs this mode into the given canvas.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- the context to install this mode into
- controller - ConcurrencyController
- The controller for this mode.
See Also
Implements
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.
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.
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.
Called once a drag has been dropped on the canvas.
Called once a drag has entered the canvas.
Called whenever a drag is over the canvas.
Called once a drag has left the canvas.
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.
This method updates the mousePosition according to the coordinates passed in.
Remarks
Parameters
A map of options to pass to the method.
- location - Point
- The current location of the mouse in world coordinates.
Overridden to only return true
if this instance does not currently have the input mutex.
Uninstalls this mode from the canvas.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- the context
Implements
Events
Occurs when a drag operation is dropped onto the CanvasComponent into which this instance is installed.
Remarks
No event is raised
- if this instance is not enabled,
- if another concurrent input mode is active or
- the data from the drag operation does not conform to the expected type.
To get additional data for the event, clients should use the sender which is set to the sending DropInputMode. The EventArgs provide no useful data.
See Also
Event Registration
addDragDroppedListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDragDroppedListener(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 operation enters the CanvasComponent into which this instance is installed.
Remarks
No event is raised
- if this instance is not enabled,
- if another concurrent input mode is active or
- the data from the drag operation does not conform to the expected type.
To get additional data for the event, clients should use the sender which is set to the sending DropInputMode. The EventArgs provide no useful data.
See Also
Event Registration
addDragEnteredListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDragEnteredListener(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 operation leaves the CanvasComponent into which this instance is installed.
Remarks
No event is raised
- if this instance is not enabled,
- if another concurrent input mode is active or
- the data from the drag operation does not conform to the expected type.
To get additional data for the event, clients should use the sender which is set to the sending DropInputMode. The EventArgs provide no useful data.
See Also
Event Registration
addDragLeftListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDragLeftListener(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 operation drags over the CanvasComponent into which this instance is installed.
Remarks
No event is raised
- if this instance is not enabled,
- if another concurrent input mode is active or
- the data from the drag operation does not conform to the expected type.
To get additional data for the event, clients should use the sender which is set to the sending DropInputMode. The EventArgs provide no useful data.
See Also
Event Registration
addDragOverListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeDragOverListener(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.