An input mode that recognizes simple mouse clicks.
Remarks
Clients register to Clicked to get notified of mouse clicks. The activeButtons property can be used to switch between the detection of right and left mouse 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.Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.input.ClickInputMode
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.
- doubleClickPolicy - DoubleClickPolicy
The click handling mode that determines the triggering behavior of Clicked and DoubleClicked. This option sets the doubleClickPolicy 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.
- validClickHitCursor - Cursor
The cursor to use when hovering over a valid hit region. This option sets the validClickHitCursor property on the created object.
- activeButtons - MouseButtons
For which button(s) mouse clicks should be processed. This option sets the activeButtons 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 or sets for which button(s) mouse clicks should be processed.
Gets the location of the last click.
Gets the installed controller.
See Also
Gets or sets the click handling mode that determines the triggering behavior of Clicked and DoubleClicked.
Gets or sets the enabled state of this input mode.
Remarks
Examples
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 state of the modifier keys at the time Clicked is invoked.
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.
Remarks
See Also
Methods
Cancels the editing of this mode.
Remarks
See Also
Implements
Creates the event recognizer that is used to recognize the clicks for this instance.
Creates the event recognizer that is used to recognize the press event for this instance.
Creates the event recognizer that is used to recognize the release event for this instance.
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
Determines whether the given event is a press event that occurred at an invalid location.
Determines whether the given event is a valid click event.
Determines whether the given event is a valid release event.
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 once this mode has recognized a double-click gesture.
Remarks
Parameters
A map of options to pass to the method.
- evt - ClickEventArgs
- The arguments.
Called once this mode has recognized a left click gesture.
Remarks
Parameters
A map of options to pass to the method.
- evt - ClickEventArgs
- The arguments.
Called once this mode has recognized a left double-click gesture.
Remarks
Parameters
A map of options to pass to the method.
- evt - ClickEventArgs
- The arguments.
Called once this mode has recognized a right click gesture.
Remarks
Parameters
A map of options to pass to the method.
- evt - ClickEventArgs
- The arguments.
Called once this mode has recognized a double-click gesture.
Remarks
Parameters
A map of options to pass to the method.
- evt - ClickEventArgs
- The arguments.
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.
Prevents a double-click event from being issued if the next click would do so and sends only a single click instead.
Remarks
The intention is for "breaking" a double click if an input mode using ClickInputMode performs actions that would lead to surprising behavior if the next click would lead to a double-click. Examples of this are GraphEditorInputMode's selection cycling where several clicks in short succession may occur, as well as creating a node by clicking on the canvas and selecting it immediately afterwards with another click.
This method's effect is very short-lived. It really only prevents a double-click event for the very next click that this input mode handles. The internal flag set by this method is re-set on every click received. This also means that if you call this method and the next click is just a regular single-click the flag is cleared nonetheless.
Returns and resets the flag set by preventNextDoubleClick.
Remarks
Called by the client in order to stop a 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 has been detected.
See Also
Event Registration
addClickedListener(function(this, ClickEventArgs):void)
Event Deregistration
removeClickedListener(function(this, ClickEventArgs):void)
Signature Details
function(sender: this, evt: ClickEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - ClickEventArgs
- An object that contains the event data.
Occurs once a double-click has been detected.
See Also
Event Registration
addDoubleClickedListener(function(this, ClickEventArgs):void)
Event Deregistration
removeDoubleClickedListener(function(this, ClickEventArgs):void)
Signature Details
function(sender: this, evt: ClickEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - ClickEventArgs
- An object that contains the event data.
Occurs once a left click has been detected.
See Also
Event Registration
addLeftClickedListener(function(this, ClickEventArgs):void)
Event Deregistration
removeLeftClickedListener(function(this, ClickEventArgs):void)
Signature Details
function(sender: this, evt: ClickEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - ClickEventArgs
- An object that contains the event data.
Occurs once a left double-click has been detected.
See Also
Event Registration
addLeftDoubleClickedListener(function(this, ClickEventArgs):void)
Event Deregistration
removeLeftDoubleClickedListener(function(this, ClickEventArgs):void)
Signature Details
function(sender: this, evt: ClickEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - ClickEventArgs
- An object that contains the event data.
Occurs once a right click has been detected.
See Also
Event Registration
addRightClickedListener(function(this, ClickEventArgs):void)
Event Deregistration
removeRightClickedListener(function(this, ClickEventArgs):void)
Signature Details
function(sender: this, evt: ClickEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - ClickEventArgs
- An object that contains the event data.
Occurs once a right double-click has been detected.
See Also
Event Registration
addRightDoubleClickedListener(function(this, ClickEventArgs):void)
Event Deregistration
removeRightDoubleClickedListener(function(this, ClickEventArgs):void)
Signature Details
function(sender: this, evt: ClickEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - ClickEventArgs
- An object that contains the event data.