Skip to main content

CompassWidget

from v9.0

This widget visualizes bearing and pitch. Click it once to reset bearing to 0, click it a second time to reset pitch to 0. Supports Map and Globe view.

Usage

import {Deck} from '@deck.gl/core';
import {CompassWidget} from '@deck.gl/widgets';

new Deck({
widgets: [new CompassWidget()]
});

Types

CompassWidgetProps

The CompassWidget accepts the generic WidgetProps and:

label (string, optional)

  • Default: 'Compass'

Tooltip message displayed while hovering a mouse over the widget.

transitionDuration (number, optional)

  • Default: 200

Bearing and pitch reset transition duration in milliseconds.

Styles

Learn more about how to replace icons in the styling guide.

NameTypeDefault
--icon-compassSVG Data UrlCustom Icon
--icon-compass-north-colorColorrgb(240, 92, 68)
--icon-compass-south-colorColorrgb(204, 204, 204)

Source

modules/widgets/src/compass-widget.tsx