Class: ViewfinderModel

ViewfinderModel()

ViewfinderModel maintains state for the ViewfinderView and interfaces with location searching services.

Constructor

new ViewfinderModel()

Since:
  • 2.28.0
Source:

Extends

  • Backbone.Model

Members

defaults :object

Type:
  • object
Properties:
Name Type Description
error string is the current error string to be displayed in the UI.
focusIndex number is the index of the element in the list of predictions that shoudl be highlighted as focus.
predictions Array.<Prediction> a list of Predictions models that correspond to the user's search query.
query string the user's search query.
viewfinderCards ViewfinderCardCategories | null is the collection of ViewfinderCards available in the current map. Renamed from zoomPresets when zoom presets were deprecated in favor of more generalized viewfinder cards.
Since:
  • 2.28.0
Source:

Methods

autocompleteSearch(rawQuery)

Get autocompletion predictions from the GeocoderSearch model.
Parameters:
Name Type Description
rawQuery string is the user's search query with spaces.
Source:

closeVisualization()

Close the visualization overlay by clearing activeVisualizationUrl on the map model.
Since:
  • 2.37.0
Source:

decrementFocusIndex()

Decrement the focused index with a minimum value of 0. This corresponds to an ArrowUp key down event. Note: An ArrowUp key press while the current index is -1 will result in highlighting the first element in the list.
Source:

goToLocation(geocoding)

Navigate to the GeocodedLocation.
Parameters:
Name Type Description
geocoding GeocodedLocation is the location that corresponds to the the selected prediction.
Source:

incrementFocusIndex()

Increment the focused index with a maximum value of the last value in the list. This corresponds to an ArrowDown key down event.
Source:

initialize(mapModel)

Parameters:
Name Type Description
mapModel Map The Map model that the ViewfinderModel is managing for the corresponding ViewfinderView.
Source:

openVisualization(url)

Open a visualization app in the full-screen iframe overlay by setting the activeVisualizationUrl attribute on the map model.
Parameters:
Name Type Description
url string The URL to load in the iframe overlay.
Since:
  • 2.37.0
Source:

resetFocusIndex()

Reset the focused index back to the initial value so that no element in the UI is highlighted.
Source:
Event handler for Backbone.View configuration that is called whenever the user clicks the search button or hits the Enter key.
Parameters:
Name Type Description
value string is the query string.
Source:

selectPrediction(prediction)

Select a prediction from the list of predictions and navigate there.
Parameters:
Name Type Description
prediction Prediction is the user-selected Prediction that needs to be geocoded and navigated to.
Source:

selectViewfinderCard(preset, actionopt)

Extended from ZoomPresetModel's selectZoomPreset() when zoom presets were deprecated in favor of generalized viewfinder cards. Select a ViewfinderCardModel from the list of cards and navigate there. When `action` is a 'map' type ctaAction, its `layerIds` and coordinates are used directly. Otherwise falls back to the preset's `enabledLayerIds` and `geoPoint` for backward compatibility.
Parameters:
Name Type Attributes Description
preset ViewfinderCardModel A user selected card.
action ViewfinderCardAction <optional>
The specific 'map' ctaAction that was activated. When omitted, the preset's own fields are used.
Source:

selectZoomPreset(preset) → {void}

Backward-compatibility alias for selectViewfinderCard.
Parameters:
Name Type Description
preset ViewfinderCardModel The card to select.
Deprecated:
  • Use selectViewfinderCard instead.
Source:
Returns:
Type
void