documentationfor yFiles for HTML 2.6

ItemHoverInputMode

An input mode for use in a GraphComponent that fires events when the mouse enters or leaves the visualization of a graph item.

Inheritance Hierarchy
ItemHoverInputMode
Implemented Interfaces

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.

Getting the ItemHoverInputMode from its parent input mode
const itemHoverInputMode = mode.itemHoverInputMode

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:

Configuring the ItemHoverInputMode to handle nodes and edges
// mode is either an instance of GraphEditorInputMode or GraphViewerInputMode

// enable the ItemHoverInputMode and let it handle edges and nodes
mode.itemHoverInputMode.enabled = true
mode.itemHoverInputMode.hoverItems = GraphItemTypes.EDGE | GraphItemTypes.NODE
// ignore items of other types which might be in front of them
mode.itemHoverInputMode.discardInvalidItems = false
// handle changes on the hovered items
mode.itemHoverInputMode.addHoveredItemChangedListener((sender, args) => {
  const oldItem = args.oldItem
  // e.g. remove the highlight from oldItem here
  const newItem = args.item
  // e.g. add a highlight to newItem here
})

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

Properties

Methods

Events