- I
Remarks
This implementation uses the hitTestable to determine where the user can begin dragging the selection. It will then use the positionHandler to delegate the actual work of moving the elements to.
This mode is exclusive by default.
Examples
Typically the MoveInputMode is installed as child mode of a GraphEditorInputMode and can be retrieved from the moveSelectedItemsInputMode property.
const moveInputMode = mode.moveSelectedItemsInputModeIf one needs to execute some code after some items have been moved by the MoveInputMode, they can register a handler to its drag-finished event. The moved items can be retrieved from the affectedItems property:
mode.moveSelectedItemsInputMode.addEventListener('drag-finished', () => {
for (const item of mode.moveSelectedItemsInputMode.affectedItems) {
// these items have been moved
}
})mode.moveViewportInputMode.allowSinglePointerMovement = true
mode.createBendInputMode.beginRecognizerTouch =
EventRecognizers.TOUCH_PRIMARY_DOWN
mode.createEdgeInputMode.beginRecognizerTouch =
EventRecognizers.TOUCH_PRIMARY_DOWN
mode.handleInputMode.beginRecognizerTouch =
EventRecognizers.TOUCH_PRIMARY_DOWN
mode.lassoSelectionInputMode.beginRecognizerTouch =
EventRecognizers.TOUCH_PRIMARY_DOWN
mode.marqueeSelectionInputMode.beginRecognizerTouch =
EventRecognizers.TOUCH_PRIMARY_DOWN
mode.moveSelectedItemsInputMode.beginRecognizerTouch =
EventRecognizers.TOUCH_PRIMARY_DOWNSee Also
Developer's Guide
Members
Constructors
Initializes a new instance of the MoveInputMode class.
Parameters
Properties
Gets an immutable snapshot of the IModelItems affected by the currently active gesture.
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 drag-started event, as well as the drag-finished event to get notified of the elements that may be or have been affected respectively by this input mode.
Property Value
Examples
mode.moveSelectedItemsInputMode.addEventListener('drag-finished', () => {
for (const item of mode.moveSelectedItemsInputMode.affectedItems) {
// these items have been moved
}
})See Also
Developer's Guide
Gets or sets the event recognizer that determines whether to start moving the selection.
See Also
Developer's Guide
See Also
Developer's Guide
Gets or sets the event recognizer that determines whether to cancel the move.
Gets the installed controller.
Gets or sets the event recognizer that constrains the current movement to be orthogonal or diagonal.
Gets or sets the event recognizer that determines whether to temporarily disable snapping.
Examples
mode.moveSelectedItemsInputMode.enabled = falseSee Also
Developer's Guide
Gets or sets the event recognizer that determines whether to re-enable temporarily disabled snapping.
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 or sets the event recognizer that determines whether to finish moving the selection.
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 the user is hovering over an item where the user can begin a move operation.
Gets the initial position where the dragging was initiated.
Gets or sets the cursor to use while moving items.
Gets or sets the event recognizer that determines whether to move the selection.
Retrieves the IInputModeContext this mode has been installed in.
null if this mode is currently not installed. Use createInputModeContext to obtain a context that has this IInputMode as the inputMode.Gets or sets the IPositionHandler that will be used as fallback to handle the actual movement of the elements during the drag.
See Also
Developer's Guide
Implements
IInputMode.priorityGets or sets the GraphSnapContext which manages snapping model items to certain coordinates (for instance, other items).
If set to null (the default) this input mode tries to obtain the GraphSnapContext from the IInputModeContext. To explicitly disable snapping, a GraphSnapContext implementation that is disabled needs to be set.
Default is null.
Methods
See Also
API
- onCanceled
Implements
IInputMode.cancelReturns the input mode context that will be passed to implementations that are called by this instance and require a context.
Creates an IInputModeContext for use with the IPositionHandler interface for the upcoming drag operation.
Installs this mode into the given context that is provided by the canvas.
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
- 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
API
- uninstall
Implements
IInputMode.installCalled after cancel has been called.
Can be overridden in subclasses to perform additional actions after the mode has been canceled.
This implementation does nothing.
Can be overridden in subclasses to perform additional actions after the mode has been activated.
Overriding implementations should call the base implementation.
Can be overridden in subclasses to perform additional actions after the mode has been deactivated.
Overriding implementations should call the base implementation.
Triggers the drag-canceled event.
Parameters
- evt: InputModeEventArgs
- The event argument that contains context information.
Overridden in
ReparentStripeInputMode.onDragCanceledTriggers the drag-canceling event.
Called once the drag has been finalized.
Parameters
- evt: InputModeEventArgs
- The event argument that contains context information.
Overridden in
ReparentStripeInputMode.onDragFinishedCalled before the drag will be finalized.
Parameters
- evt: InputModeEventArgs
- The event argument that contains context information.
Called at the end of each drag.
Parameters
- evt: InputModeEventArgs
- The event argument that contains context information.
Called at the start of each drag.
Parameters
- evt: InputModeEventArgs
- The event argument that contains context information.
Triggers the drag-started event.
Triggers the drag-starting event.
Parameters
- evt: InputModeEventArgs
- The event argument that contains context information.
Overridden in
ReparentStripeInputMode.onDragStartingRaises the query-position-handler event.
Parameters
- evt: QueryPositionHandlerEventArgs
- The QueryPositionHandlerEventArgs instance containing the event data.
Called after tryStop has been called.
Can be overridden in subclasses to perform additional actions after the mode has been stopped.
This implementation does nothing.
Simulates the start of a drag and puts the state machine into the dragging state.
location.Parameters
- location: Point
- The location where the drag had been initialized.
Return Value
- Promise<IEnumerable<IModelItem>>
- A task that represents the asynchronous drag operation. The result of the task contains the affected items or
nullif the drag was canceled.
falseReturn Value
- boolean
trueif and only if the editing has been stopped or there was no edit in progress
Implements
IInputMode.tryStopUninstalls this mode from the given context.
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
- context: IInputModeContext
- The context to deregister from. This is the same instance that had been passed to install during installation.
Implements
IInputMode.uninstallEvents
Occurs when the drag has been canceled.
Properties of
InputModeEventArgs- context: IInputModeContext
- Gets the context for the current event.
See Also
Developer's Guide
Occurs before the drag will be canceled.
Properties of
InputModeEventArgs- context: IInputModeContext
- Gets the context for the current event.
See Also
Developer's Guide
Occurs once the drag has been finished.
Properties of
InputModeEventArgs- context: IInputModeContext
- Gets the context for the current event.
Examples
mode.moveSelectedItemsInputMode.addEventListener('drag-finished', () => {
for (const item of mode.moveSelectedItemsInputMode.affectedItems) {
// these items have been moved
}
})See Also
Developer's Guide
Occurs before the drag will be finished.
Properties of
InputModeEventArgs- context: IInputModeContext
- Gets the context for the current event.
See Also
Developer's Guide
Occurs once the drag is initialized and has started.
Properties of
InputModeEventArgs- context: IInputModeContext
- Gets the context for the current event.
See Also
Developer's Guide
Occurs once the drag is starting.
Properties of
InputModeEventArgs- context: IInputModeContext
- Gets the context for the current event.
See Also
Developer's Guide
Occurs at the end of every drag.
Properties of
InputModeEventArgs- context: IInputModeContext
- Gets the context for the current event.
See Also
Developer's Guide
Occurs at the start of every drag.
Properties of
InputModeEventArgs- context: IInputModeContext
- Gets the context for the current event.
See Also
Developer's Guide
Occurs when a drag is recognized for the MoveInputMode.
Properties of
QueryPositionHandlerEventArgs- context: IInputModeContext
- Gets the context for the current event.
- handled: booleanwritable
- Gets or sets a value indicating whether this QueryPositionHandlerEventArgs has been handled.
- positionHandler: IPositionHandlerwritable
- Gets or sets the IPositionHandler to use for the movement of the items that are affected by the MoveInputMode.
- queryLocation: Point
- Gets the location of the movement (where the drag has started).
See Also
Developer's Guide