Abstract base class implementation of an IInputMode that can be used concurrently with other IInputMode implementations if its exclusive property is true
.
Remarks
Type Details
- yFiles module
- view
Constructors
Initializes a new instance of the InputModeBase class.
Properties
Gets if this mode is active.
Remarks
Gets the installed controller.
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 whether this mode is currently installed so a call to parentInputModeContext will yield a non- null
result.
See Also
Gets the context instance this mode is currently installed in or null
if this instance is not installed.
Remarks
Gets the priority of this input mode.
Remarks
Implements
Methods
Cancels the editing of this mode by first disabling and afterward re-enabling the installed controller.
Remarks
See Also
Implements
Determines whether this instance can request the mutex.
Remarks
Returns
- ↪boolean
- Whether a call to requestMutex would currently succeed.
Creates an implementation of IInputModeContext that is specific to this mode.
Remarks
This is needed for events that are triggered by this InputMode to signal where the event is coming from. A common usage for this is, for example, in isHit calls.
The result can be given to isHit or enumerateHits to let implementations of IHitTestable get access to the current IInputModeContext. This can be done by looking up IInputModeContext from the ICanvasContext's lookup method or simply downcasting.
Returns
- ↪IInputModeContext
- A readily configured IInputModeContext.
See Also
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 should be made available in the context property.
May be omitted, in which case a child context for this instance is created automatically.
Returns
- ↪InputModeEventArgs
- An input mode event argument that is configured for this instance.
Determines whether this instance owns the input mutex.
Remarks
false
.Returns
- ↪boolean
- Whether this instance has the input mutex.
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 parentInputModeContext 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 a CanvasComponent using the provided IInputModeContext.
Remarks
base.Install(context)
, first. One-time initialization should be performed in the initialize method. This implementation will call the initialize method the first time this mode gets installed. The initialization will be surrounded by calls to onInitializing and onInitialized to trigger the corresponding events.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
Event dispatch method that will dispatch the canceled event.
Remarks
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event arguments.
See Also
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.
Event dispatch method that will dispatch the initialized event.
Remarks
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event arguments.
See Also
Event dispatch method that will dispatch the initializing event.
Remarks
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event arguments.
See Also
Called when this instance obtains the mutex.
Remarks
Called when this instance released the mutex.
Remarks
Event dispatch method that will dispatch the stopped event.
Remarks
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The event arguments.
See Also
Releases previously captured keyboard input.
See Also
Releases the mutex that is currently owned by this instance.
Remarks
Requests capturing of all keyboard input that happens in the CanvasComponent.
Remarks
true
, which will prevent visuals inside the canvas from stealing keystrokes.See Also
Requests the mutex from the current controller.
Remarks
Throws
- Exception({ name: 'Error' })
- If the mutex could not be obtained.
Requests capturing of all MOUSE, TOUCH and PEN input that happens in the CanvasComponent.
Remarks
true
, which will prevent visuals inside the canvas from stealing mouse input.See Also
Tries to stop the editing.
Remarks
This implementation returns if this instance does not currently have the input mutex.
This implementation calls onStopped. Subclasses that want to prevent a stop or need to do special clean up should do this here if the base class implementation of tryStop returns true
. A typical implementation should follow this idiom if it wants to stop:
if (mode.tryStop()) {
// do cleanup
return true
}
return false
If it doesn't want to stop, simply return false
immediately.
Calling this method raises the stopped event.
Returns
- ↪boolean
true
iff this instance does not own the mutex.
See Also
Implements
Uninstalls this mode from the canvas.
Remarks
base.Uninstall(context)
as the last statement.Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to remove this mode from. This is the same instance that has been passed to install.
Implements
Events
Occurs after the call to cancel
Remarks
See Also
Occurs after the call to initialize
Remarks
See Also
Occurs before the call to initialize
Remarks
See Also
Occurs after the call to tryStop