Customizing Cursors
Input modes often indicate that a certain interaction is possible or in progress by changing the mouse cursor. For example, when the mouse hovers over a movable item, MoveInputMode changes the cursor to a move cursor.
In Priorities and Exclusiveness you have learned that MultiplexingInputModes
like GraphEditorInputMode or GraphViewerInputMode keep a list of their input modes sorted by priority. This list is processed
from highest to lowest priority, and the first preferredCursor that is not null
determines the current cursor.
If no input mode has a non-null
preferredCursor, the multiplexing input mode’s
defaultCursor is used.
For example, when the mouse hovers over a node, CreateEdgeInputMode indicates that it is possible to create an edge there by changing the cursor to a hand. However, if the node is movable, MoveInputMode also wants to indicate possible interaction with a move cursor. Since MoveInputMode has higher priority, the parent input mode chooses its cursor.



As soon as a GraphEditorInputMode, GraphViewerInputMode, or another MultiplexingInputMode is registered as the GraphComponent's inputMode, that input mode will change the GraphComponent's cursor with its child mode’s preferred cursors. Therefore, any cursor set on the GraphComponent will be changed. To set a new default cursor, set it as the defaultCursor.
Ideally, cursors are handled automatically by the input modes. Setting the defaultCursor should only be necessary if a default cursor should be set or if the cursor should indicate something that is not handled by an input mode.If the expected cursor is not displayed properly, this might indicate that the input mode doesn’t recognize the current gesture or another input mode takes precedence. Please refer to Priorities and Exclusiveness to let your input mode handle the desired gesture.
The built-in input modes usually have properties for each of their interaction states. For example, CreateEdgeInputMode's validBeginCursor indicates that an edge creation can start at the current location, whereas its validEndCursor indicates that the edge might end at the current location. Developers who want to change the yFiles defaults should look for such properties.