An input mode that recognizes pointer clicks or taps.
Remarks
Clients register to clicked to get notified of pointer clicks.
This mode can be instructed to swallow clicks if they happen shortly after the control gained focus. This is useful to prevent accidental clicks from being processed if the user wanted to put the focus into the control, only.
This mode is exclusive by default.
Examples
ClickInputMode
is installed as child mode of a GraphEditorInputMode or GraphViewerInputMode and can be retrieved from the clickInputMode property.const clickInputMode = mode.clickInputMode
Type Details
- yFiles module
- view
See Also
Constructors
Creates a new instance of this mode that detects left mouse clicks.
Parameters
A map of options to pass to the method.
- 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.
- clickReportingPolicy - ClickReportingPolicy
- When the clicked event should be raised regarding single clicks. This option sets the clickReportingPolicy property on the created object.
- validClickHitTestable - IHitTestable
- A hit test that determines where this mode should recognize clicks. This option sets the validClickHitTestable property on the created object.
- requestMutexOnClick - boolean
- Whether to request the mutex on a click. This option sets the requestMutexOnClick property on the created object.
- validClickHitTestableTouch - IHitTestable
- A hit test that determines where this mode should recognize click events that were caused by touch input. This option sets the validClickHitTestableTouch property on the created object.
- validClickHitCursor - Cursor
- The cursor to use when hovering over a valid hit region. This option sets the validClickHitCursor property on the created object.
- swallowFocusClick - boolean
- A property that determines whether clicks should be swallowed if they happen within a short amount of time after the CanvasComponent got focus. This option sets the swallowFocusClick property on the created object.
Properties
Gets the location of the last click.
Gets or sets when the clicked event should be raised regarding single clicks.
Remarks
See Also
Gets the installed controller.
See Also
Gets or sets the enabled state of this input mode.
Remarks
Examples
mode.clickInputMode.enabled = false
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.
Retrieves the IInputModeContext this mode has been installed in.
Remarks
null
if this mode is currently not installed. Use createInputModeContext to obtain a context that has this IInputMode as the inputMode.Gets the priority of this input mode.
Remarks
See Also
Implements
Gets or sets whether to request the mutex on a click.
Remarks
true
this will discard other concurrent input modes on a click. The default is true
.Gets or sets a property that determines whether clicks should be swallowed if they happen within a short amount of time after the CanvasComponent got focus.
Remarks
false
. If set to true
, clicks are discarded within 100 ms after the focus entered.See Also
Gets or sets the cursor to use when hovering over a valid hit region.
Remarks
null
and the current cursor is used instead.Gets or sets a hit test that determines where this mode should recognize clicks.
Gets or sets a hit test that determines where this mode should recognize click events that were caused by touch input.
Methods
Cancels the editing of this mode.
Remarks
See Also
Implements
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
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.
Overriding implementations should call the base implementation first.
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 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 once this mode has recognized a click gesture.
Remarks
Parameters
A map of options to pass to the method.
- evt - ClickEventArgs
- The arguments.
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 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.
Will be called to request a stop of the current editing progress.
Remarks
false
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
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
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.
Implements
Events
Occurs once a click or tap has been detected.