The CursorManager allows to change the cursor displayed on a DOM node.

It addresses the problem of multiple clients changing the cursor style of an element, overriding the visual feedback. The cursor manager maintains a stack of cursors, so an old cursor can be restored when a newer one becomes inactive.

For example, a spinning icon indicates a layer that's loading. Then an editor changes it to a crosshair, overriding the spinning icon. When the crosshair is removed by the editor, the manager will revert to the spinning icon. Without the manager, the map's cursor would not be able to revert to the spinning icon.

This manager is used by the DOM node. Editors use addCursor to show a new cursor on the map when handles are active. They get back a Handle. By calling handle.remove() they can detach the cursor from the map, and the last visible cursor will be shown.

See the Implementing custom user interaction guide for more information on working with cursors on the map.

See

Map.cursorManager

Since

2022.1

Hierarchy

  • CursorManager

Constructors

Accessors

Methods

Constructors

Accessors

Methods

  • Adds a new cursor to the stack of cursors. The new cursor becomes active on the managed DOM node. The passed cssCursorStyle is assigned to the cursor style.

    Parameters

    Returns CursorHandle