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

applyMapAction(card, actionopt)

Apply a map action from a viewfinder card by toggling layers and optionally navigating to coordinates.
Parameters:
Name Type Attributes Description
card ViewfinderCardModel The source card model.
action ViewfinderCardAction <optional>
The map action from the card.
Since:
  • 2.38.0
Source:

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(actionOrUrl)

Open a visualization app in the full-screen iframe overlay by setting the activeVisualizationUrl attribute on the map model.
Parameters:
Name Type Description
actionOrUrl object | string A configured iframe action object, or a raw URL string for backward compatibility.
Since:
  • 2.38.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(card, actionopt) → {void}

Backward-compatibility alias for applyMapAction.
Parameters:
Name Type Attributes Description
card ViewfinderCardModel The card to apply.
action ViewfinderCardAction <optional>
The card action.
Since:
  • 2.38.0
Deprecated:
  • Use applyMapAction instead.
Source:
Returns:
Type
void

selectZoomPreset(preset) → {void}

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