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-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.input.InputModeBase
Constructors
Initializes a new instance of the InputModeBase class that is exclusive by default.
Initializes a new instance of the InputModeBase class.
Parameters
A map of options to pass to the method.
- exclusive - boolean
- Iff this mode should be exclusive.
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 the context instance this mode is currently installed in or null
if this instance is not installed.
Remarks
Implements
Gets whether this mode is currently installed in a CanvasComponent.
See Also
Gets the priority of this input mode.
Remarks
See Also
Implements
Methods
Cancels the editing of this mode by first disabling and afterwards reenabling 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 signalize 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 hitElementsAt 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 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.
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 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 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 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 key strokes.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 and touch 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
} else {
return false
}
and 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
Event Registration
addCanceledListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeCanceledListener(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 after the call to initialize
Remarks
See Also
Event Registration
addInitializedListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeInitializedListener(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 call to initialize
Remarks
See Also
Event Registration
addInitializingListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeInitializingListener(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 after the call to tryStop
Remarks
See Also
Event Registration
addStoppedListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeStoppedListener(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.