An input mode for use in a GraphComponent that fires events when the mouse enters or leaves the visualization of a graph item.
Remarks
This mode can be used to determine when the mouse is being moved from one item to the next.
This mode is exclusive by default.
Examples
Typically the ItemHoverInputMode
is installed as child mode of a GraphEditorInputMode or GraphViewerInputMode and can be retrieved from the itemHoverInputMode property.
The ItemHoverInputMode
raises the HoveredItemChanged event each time cursor hovers over a different item or the canvas in which case the hovered item is null
. One can also configure the item types which are reported:
Related Programming Samples
- Graph Viewer
- Displays sample graphs from various application domains.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.input.ItemHoverInputMode
Constructors
Initializes a new instance of the ItemHoverInputMode class.
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.
- hoverItems - GraphItemTypes
Which graph items are considered by this input mode. This option sets the hoverItems property on the created object.
- hoverCursor - Cursor
The cursor to use when the mouse is hovering over a isValidHoverItem valid hover item. This option sets the hoverCursor property on the created object.
- discardInvalidItems - boolean
A value indicating whether items that have been hit at the current location that are not valid items should be ignored (and an underlying valid item be considered instead) or reported as
null
. This option sets the discardInvalidItems property on the created object.
Properties
Gets the installed controller.
Gets the current item the mouse is hovering over.
Gets or sets a value indicating whether items that have been hit at the current location that are not valid items should be ignored (and an underlying valid item be considered instead) or reported as null
.
Remarks
Set this to true
if invalid items should be reported as null
. Set this to false
to let hit test enumeration continue to find the next valid item.
The default is true
.
See Also
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 or sets the cursor to use when the mouse is hovering over a isValidHoverItem valid hover item.
Gets or sets which graph items are considered by this input mode.
Remarks
The default is ALL.
Note that the default is set to a different value if this mode is a child mode of the GraphEditorInputMode or GraphViewerInputMode. The different default is set in createItemHoverInputMode and documented there.
Examples
Gets the context instance this mode is currently installed in or null
if this instance is not installed.
Remarks
Implements
Gets the priority of this input mode.
Remarks
See Also
Implements
Methods
Called by the client to unconditionally cancel all editing.
Remarks
This will be called prior to the uninstalling of this instance.
In order to stop an active input mode manually, client code should use the following idiom:
if (!mode.tryStop()) {
mode.cancel()
}
Implements
Gets the items that have been hit at the given location.
Parameters
A map of options to pass to the method.
- location - Point
- The location in world coordinates to query.
Returns
- ↪IEnumerable<IModelItem>
- An enumerable over all items that have been hit at the given location.
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 item is a valid item to be considered for hovering.
Remarks
Parameters
A map of options to pass to the method.
- item - IModelItem
- The item to check.
Returns
- ↪boolean
true
if it is valid to report a hover over the specified item;false
otherwise.
See Also
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 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.
Raises the HoveredItemChanged event.
Parameters
A map of options to pass to the method.
- evt - HoveredItemChangedEventArgs
- The HoveredItemChangedEventArgs instance containing the event data.
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.
Overridden to only return true
if this instance does not currently have the input mutex.
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
Forces a reevaluation of the item that the mouse is currently hovering over or at a specific location.
Remarks
Parameters
A map of options to pass to the method.
- location - Point
- The query location.
Events
Occurs when the item that is being hovered over with the mouse changes.
Remarks
Examples
null
. One can also configure the item types which are reported:Event Registration
addHoveredItemChangedListener(function(this, HoveredItemChangedEventArgs):void)
Event Deregistration
removeHoveredItemChangedListener(function(this, HoveredItemChangedEventArgs):void)
Signature Details
function(sender: this, evt: HoveredItemChangedEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - HoveredItemChangedEventArgs
- An object that contains the event data.