A composite IInputMode implementation that additionally can deal with exclusive instances.
Remarks
Instances of this class can install and uninstall multiple IInputModes. Child input modes can be added using the add method. By providing priorities to the different modes, their installation order can be influenced. Input modes with lower priorities are handled earlier.
Child input modes can run exclusively while they hold the mutex. Other exclusive input modes are temporarily deactivated until the mutex is released. This can be controlled by setting the exclusive property on the controller. Input modes that disable the exclusive property will always run concurrently with all other input modes.
This class itself implements the IInputMode interface so that hierarchies of instances of this class can easily be built. This class will request the input mutex if one of its child modes requests the mutex. Also if the instance itself gets disabled, it will stop or cancel the current owner of the mutex.
Examples
const multiplexingInputMode = new MultiplexingInputMode()
const waitInputMode = new WaitInputMode()
waitInputMode.priority = 0
multiplexingInputMode.add(waitInputMode)
const moveInputMode = new MoveViewportInputMode()
moveInputMode.priority = 5
multiplexingInputMode.add(moveInputMode)
graphComponent.inputMode = multiplexingInputMode
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.input.MultiplexingInputMode
See Also
Constructors
Creates an instance with no initial modes.
Parameters
A map of options to pass to the method.
- 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.
- priority - number
- defaultCursor - Cursor
The cursor to use whenever no child mode prefers a different cursor. This option sets the defaultCursor property on the created object.
Properties
Gets the installed controller.
Gets or sets the cursor to use whenever no child mode prefers a different cursor.
Gets or sets the enabled state of this input mode.
Remarks
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 IInputMode that currently owns the mutex.
Gets the priority of this input mode.
Remarks
See Also
Implements
Methods
Adds the given mode
.
Remarks
The input modes will be ordered according to their priority: Input modes with lower priority will be installed earlier.
Input modes will run exclusively if the exclusive property of their installed controller is set to true
. Otherwise they can not and will not be deactivated if another IInputMode acquires the mutex.
Parameters
A map of options to pass to the method.
- mode - IInputMode
- The input mode to add to this mode.
Throws
- Exception({ name: 'ArgumentError' })
- If the same
mode
has is already added to this instance.
Examples
const multiplexingInputMode = new MultiplexingInputMode()
const waitInputMode = new WaitInputMode()
waitInputMode.priority = 0
multiplexingInputMode.add(waitInputMode)
const moveInputMode = new MoveViewportInputMode()
moveInputMode.priority = 5
multiplexingInputMode.add(moveInputMode)
graphComponent.inputMode = multiplexingInputMode
const mode = new GraphEditorInputMode()
const customInputMode = new CustomInputMode()
customInputMode.priority = 10
mode.add(customInputMode)
Adjusts the cursor of the CanvasComponent according to the current input mutex owner or the first mode in the list whose ConcurrencyController returns a non-null preferredCursor.
Remarks
Cancels all modes.
Implements
Called by the child context's lookup method.
Parameters
A map of options to pass to the method.
Returns
- ↪any
- The result of the lookup query, or
null
.
See Also
Yields an IInputModeContext for the child modes of this mode.
Remarks
Returns
- ↪IInputModeContext
- A new instance that delegates to the parent's context.
Helper method that yields a suitably configured InputModeEventArgs for this input mode.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
An input mode context that is available in the InputModeEventArgs.
Can be
null
in which case a new context for this instance is created automatically.
Returns
- ↪InputModeEventArgs
- An input mode event argument that is configured for this instance.
Returns a list of all modes managed by this instance in sorted order.
Returns
- ↪IList<IInputMode>
- A list of the modes.
Performs one-time initialization of this instance.
Remarks
This method should not be invoked by subclasses. This will be done automatically upon first installation of this mode.
This code will be executed only once per instance. The inputModeContext property will be null
when this code is executed. This method should not be used to install this mode into a specific canvas. Subclasses should always call base.Initialize()
first.
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.
When this instance gets uninstalled from the context the same context instance will be passed to it.
Implementations may hold a reference to the context
instance and use it while they are being installed.
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 ConcurrencyController for this mode.
See Also
Implements
Invalidates the canvas this mode is currently installed in.
Called after the active property of the installed ConcurrencyController has been set to true
.
Remarks
Called after the active property of the installed ConcurrencyController has been set to false
.
Remarks
null
and releases the mutex if the mutex is currently owned by this instance. Also, all concurrent child modes will be disabled.Removes the given mode from this compound mode.
Parameters
A map of options to pass to the method.
- mode - IInputMode
- The mode to remove.
Called when the priority of an installed sub mode has changed.
Remarks
Tries to stop all modes.
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
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.