▾
import ViewOptions from "@arcgis/core/views/interactive/options/ViewOptions.js";const ViewOptions = await $arcgis.import("@arcgis/core/views/interactive/options/ViewOptions.js");- Inheritance
- ViewOptions→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Configures snapping, tooltips, display units, and input units for supported components, view models, and analyses through View.options.
Unlike inherited snapping and tooltip options, display and input units can be overridden individually through
unit properties exposed by a component, view model, or analysis.
For example, setting DistanceMeasurementAnalysis.unit to feet overrides
view.options.displayUnits.length for that analysis without changing the view's configuration or other analyses.
Setting the analysis unit back to null restores the unit configured through view.options.displayUnits.length.
The following table shows which components, view models, and analyses inherit each option from view.options.
- ✓: The option is inherited, with explicit component, view model, or analysis units taking precedence as described above.
Opt-in: The option is inherited only when the component's or view model'suseViewOptionsproperty istrue.- ✗: The capability exists but does not inherit the option from the view. See the corresponding footnote.
N/A: The capability is unavailable for that component or analysis (for example, Area Measurement 3D does not support tooltips at all).
| Component or analysis | Inherits view.options.snapping | Inherits view.options.tooltips | Inherits view.options.displayUnits | Inherits view.options.inputUnits |
|---|---|---|---|---|
| Area Measurement 2D | ✗¹ | ✓ | ✓ | ✓ |
| Area Measurement 3D | ✓ | N/A | ✓ | N/A |
| Distance Measurement 2D | ✗¹ | ✓ | ✓ | ✓ |
| Direct Line Measurement 3D | ✓ | N/A | ✓ | N/A |
| Elevation Profile | ✓ | N/A | ✓ | N/A |
| Line of Sight | ✓ | ✓ | ✓ | ✓ |
| Viewshed | ✓ | ✓ | ✓ | ✓ |
| Length Dimension | ✓ | N/A | ✓ | N/A |
| Volume Measurement | ✓ | ✗² | ✓ | ✓ |
| Sketch | Opt-in³ | Opt-in³ | Opt-in³ | Opt-in³ |
| Editor | Opt-in³ | Opt-in³ | Opt-in³ | Opt-in³ |
-
For 2D measurements, configure snapping through the component's own
snappingOptions, AreaMeasurementAnalysisView2D.snappingOptions, or DistanceMeasurementAnalysisView2D.snappingOptions. Support forview.options.snappingis planned for a future release. -
The Volume Measurement cut-fill elevation tooltip remains enabled independently of
view.options.tooltips. -
For Sketch and Editor, including SketchViewModel and EditorViewModel, set the component's or view model's
useViewOptionsproperty totrue(default:false) to use options on the view. Changes to this property apply to the next create or update operation, not an operation already in progress.When this property is
true:- Snapping and tooltip options specified on the component or view model are preserved but ignored.
- The corresponding controls in the component's Settings menu are hidden.
- Where unit properties are exposed, explicit units override those configured through
view.optionsper measurement type. - Set an explicit unit to
nullorundefinedto use the unit fromview.optionsfor that measurement type again.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | The initial snapping, tooltip, and unit options. | |
Properties
| Property | Type | Class |
|---|---|---|
| readonly inherited | ||
| | ||
| | ||
| | ||
| |
displayUnits
- Type
- Units
Units for displaying measurements, such as lengths, areas, and volumes.
Each unit can be configured independently. Unset units use the defaults of the component, view model, or analysis. A display unit set directly on a component, view model, or analysis overrides the corresponding unit on the view, without changing the view's options or the units used by other components, view models, or analyses.
inputUnits
- Type
- Units
Units for interpreting numeric values entered by the user.
Input units may differ from displayUnits. Each unit can be configured independently. Unset units use the defaults of the component, view model, or analysis. An input unit set directly on a component, view model, or analysis overrides the corresponding unit on the view, without changing the view's options or the units used by other components, view models, or analyses. These options control numeric input in the UI, not the spatial reference or stored coordinates of a geometry.
snapping
- Type
- SnappingOptions
Options for snapping to geometry guides and features.
Snapping is disabled by default in a MapView and enabled by default in a SceneView.
Known Limitations
These options currently do not apply to AreaMeasurementAnalysisView2D or
DistanceMeasurementAnalysisView2D, including their measurement components.
Configure snappingOptions on the analysis view or component instead. Tooltip and unit options configured through
view.options still apply. Support for view.options.snapping in these analyses and components is planned for a future release.
tooltips
- Type
- TooltipOptions
Options for tooltips shown while sketching, editing, or placing analyses.
Tooltips are disabled by default in both MapView and SceneView.
Known Limitations
The Volume Measurement cut-fill elevation tooltip remains enabled independently of these options. Its display and input units can still inherit ViewOptions.displayUnits and ViewOptions.inputUnits.