documentationfor yFiles for HTML 3.0.0.3

ItemHoverInputMode

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

Inheritance Hierarchy
ItemHoverInputMode
Implemented Interfaces

Remarks

This mode can be used to determine when the pointer 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 hovered-item-changed event each time the 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
// handle changes on the hovered items
mode.itemHoverInputMode.addEventListener(
  'hovered-item-changed',
  (evt) => {
    const oldItem = evt.oldItem
    // e.g. remove the highlight from oldItem here
    const newItem = evt.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

Constructors

Properties

Methods

Events