Skip to main content

ResetViewWidget

from v9.2

This widget resets the view state of a deck.gl viewport to its initial state. The user clicks the widget to return to the initial view.

import {Deck} from '@deck.gl/core';
import {ResetViewWidget} from '@deck.gl/widgets';
import '@deck.gl/widgets/stylesheet.css';

new Deck({
initialViewState: {
longitude: 0,
latitude: 52,
zoom: 4
},
controller: true,
widgets: [
new ResetViewWidget({
initialViewState: {
longitude: -20,
latitude: 15,
zoom: 0
}
})
]
});

Constructor

import {ResetViewWidget, type ResetViewWidgetProps} from '@deck.gl/widgets';
new ResetViewWidget({} satisfies ResetViewWidgetProps);

Types

ResetViewWidgetProps

The ResetViewWidget accepts the generic WidgetProps and:

label (string, optional)

  • Default: 'Reset View'

Tooltip message displayed while hovering a mouse over the widget.

initialViewState (ViewState, optional)

  • Default: deck.props.initialViewState

The initial view state to reset the view to.

Styles

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

NameTypeDefault
--icon-reset-viewSVG Data Url[Material Symbol Reset Focus][icon_reset_view]

Source

modules/widgets/src/reset-view-widget.tsx