import CompassViewModel from "@arcgis/core/widgets/Compass/CompassViewModel.js";const CompassViewModel = await $arcgis.import("@arcgis/core/widgets/Compass/CompassViewModel.js");- Inheritance:
- CompassViewModel→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.0
Provides the logic for the Compass widget and component.
The Compass indicates where north is in relation to the current view MapView.rotation or camera heading. This is added to a SceneView by default.
- See also
Compass widget - Deprecated since 4.32. Use the Compass component instead.
Constructors
Constructor
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
See the properties table for a list of all the
properties that may be passed into the constructor.
Properties
Any properties can be set, retrieved or listened to. See the
Watch for changes
topic.
| Property | Type | Class |
|---|---|---|
declaredClass readonly inherited | ||
goToOverride inherited | ||
orientation readonly | | |
state readonly | | |
| |
goToOverride
inherited Property
- Type
- GoToOverride | null | undefined
Inherited from: GoTo
- Since
- ArcGIS Maps SDK for JavaScript 4.8
This function provides the ability to override either the MapView goTo() or SceneView goTo() methods.
- See also
Example
// The following snippet uses Search but can be applied to any// widgets that support the goToOverride property.search.goToOverride = function(view, goToParams) { goToParams.options = { duration: updatedDuration }; return view.goTo(goToParams.target, goToParams.options);}; view
Property
- Type
- MapViewOrSceneView | null | undefined
The view in which the Compass obtains and indicates camera Camera.heading, using a (SceneView) or MapView.rotation (MapView).
Methods
| Method | Signature | Class |
|---|---|---|
reset(): void | |
reset
Method
- Signature
-
reset (): void
If working in a MapView, sets the view's
MapView.rotation is to 0. If working in a
SceneView, sets the camera's
Camera.heading to 0.
This method is executed each time the Compass is clicked.
- Returns
- void