C

ClickInputMode

An input mode that recognizes pointer clicks or taps.
ImplementsInheritance Hierarchy

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

Typically the ClickInputMode is installed as child mode of a GraphEditorInputMode or GraphViewerInputMode and can be retrieved from the clickInputMode property.
Getting the ClickInputMode from its parent input mode
const clickInputMode = mode.clickInputMode

See Also

Developer's Guide

API

clickReportingPolicy, swallowFocusClick

Members

Show:

Constructors

Creates a new instance of this mode that detects left mouse clicks.

Parameters

Properties

Gets the location of the last click.
readonlyfinal
Gets or sets when the clicked event should be raised regarding single clicks.
By default, single clicks are raised instantly. Alternatively, a follow-up click can be awaited to report only a double click. If no second click follows within doubleClickTime the single click event is raised.
conversionfinal

See Also

Developer's Guide
API
ClickReportingPolicy
Gets the installed controller.
protectedreadonlyfinal

See Also

API
install
Gets or sets the enabled state of this input mode.
Clients can use this property to disable or reenable this instance. This will set the enabled property of the installed controller so a disabled instance should never try to acquire the input mutex.

Examples

Disabling the ClickInputMode on its parent input mode
mode.clickInputMode.enabled = false
Gets or sets a value indicating whether this mode will be the only one running when it has the mutex.

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.

final
Retrieves the IInputModeContext this mode has been installed in.
The value will be null if this mode is currently not installed. Use createInputModeContext to obtain a context that has this IInputMode as the inputMode.
protectedreadonlyfinal
Gets the priority of this input mode.
The priority will influence the order in which the modes will be installed into the CanvasComponent. The lower the priority value, the earlier it will be installed. If two modes are using the same priority value, the first one to be registered will be installed earlier.
final
Gets or sets whether to request the mutex on a click.
If set to true this will discard other concurrent input modes on a click. The default is true.
final
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.
The default is false. If set to true, clicks are discarded within 100 ms after the focus entered.
final

See Also

Developer's Guide
Gets or sets the cursor to use when hovering over a valid hit region.
The default is null and the current cursor is used instead.
conversionfinal
Gets or sets a hit test that determines where this mode should recognize clicks.
The default implementation is ALWAYS.
final

See Also

Developer's Guide
Gets or sets a hit test that determines where this mode should recognize click events that were caused by touch input.
The default implementation is ALWAYS.
final

See Also

Developer's Guide

Methods

Cancels the editing of this mode.
This implementation releases the mutex if it is currently owned by this instance and calls onCanceled.

See Also

API
onCanceled
Creates an implementation of IInputModeContext that is specific to this mode.

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.

protected

Return Value

IInputModeContext
A readily configured IInputModeContext.

See Also

API
enumerateHits, isHit, IInputModeContext
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
Called after cancel has been called.

Can be overridden in subclasses to perform additional actions after the mode has been canceled.

This implementation does nothing.

protected
Called once this mode has recognized a click gesture.
This method will trigger the clicked event.
protected

Parameters

evt: ClickEventArgs
The arguments.
Called after the active property of the installed ConcurrencyController has been set to true.

Can be overridden in subclasses to perform additional actions after the mode has been activated.

Overriding implementations should call the base implementation.

protected
Called after the active property of the installed ConcurrencyController has been set to false.

Can be overridden in subclasses to perform additional actions after the mode has been deactivated.

Overriding implementations should call the base implementation.

protected
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.

protected
Will be called to request a stop of the current editing progress.
This should stop the current edit, if one is in progress, and possibly commit all pending changes. If stopping is not possible, this method can return false

Return Value

boolean
true if and only if the editing has been stopped or there was no edit in progress
Uninstalls 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.

Events

Occurs once a click or tap has been detected.
This is the case if a pointer down has directly been followed by a pointer up.

Properties of

ClickEventArgs
altKey: boolean
Gets a value indicating whether the alt modifier was pressed at the time of the click.
clickCount: number
Gets the number of clicks associated with this event.
context: IInputModeContext
Gets the context for the current event.
ctrlKey: boolean
Gets a value indicating whether the control modifier was pressed at the time of the click.
handled: boolean
writable
Gets or sets a value indicating whether this instance has been handled.
location: Point
Gets the location of the click.
metaKey: boolean
Gets a value indicating whether the meta modifier was pressed at the time of the click.
modifiers: ModifierKeys
Gets the state of the modifiers at the time of the click.
originalEventArgs: PointerEventArgs
Gets the pointer event args that caused this event.
pointerButtons: PointerButtons
Gets the PointerButtons that have changed for this event.
pointerType: PointerType
Gets the type of the pointer that was the source of this event.
shiftKey: boolean
Gets a value indicating whether the shift modifier was pressed at the time of the click.

See Also

Developer's Guide
API
ClickEventArgs, clickReportingPolicy