Class: ViewfinderCardView

ViewfinderCardView()

This class was generalized from ZoomPresetView when zoom presets were deprecated in favor of viewfinder cards in 2.37.0. It shows the title, description, and action buttons for a configured card within a MapView. Cards can also contain an image hero banner behind the title. Action buttons have two styles determined by their ordinality and are driven by `buttons` on the model with configurable text and icons. 'map' type actions (secondary ordinality) render as a plain-text secondary link, while 'iframe'/'tab' type actions (primary ordinality) render as bordered buttons. The card body itself is no longer interactive — all interactions are explicit buttons.

Screenshot

Constructor

new ViewfinderCardView()

Since:
  • 2.37.0
Source:

Extends

  • Backbone.View

Members

className

Source:

templateVars

Values meant to be used by the rendered HTML template.
Source:

type :string

The type of View this is
Type:
  • string
Source:

Methods

events()

The events this view will listen to and the associated function to call.
Source:

handleButtonClick(e)

Dispatch a primary button click to the registered handler for the action type. Closes any open visualization overlay first.
Parameters:
Name Type Description
e MouseEvent The click event from a `.button-primary` element.
Source:

initialize(options)

Initialize the view with the given options.
Parameters:
Name Type Description
options object The view options.
Properties
Name Type Attributes Description
preset ViewfinderCardModel The metadata associated with this viewfinder card.
selectCallback function <optional>
Called when "View Layers" is clicked. Should zoom to the card location and toggle layers.
ctaCallback function <optional>
Called with (url) when "Explore in App" is clicked. Should open the visualization overlay.
closeVisualizationCallback function <optional>
Called before any button action to dismiss any currently open overlay.
onActivate function <optional>
Called when this card is activated, so sibling cards can reset their active state.
Source:

render()

Render the view by updating the HTML of the element. The new HTML is computed from an HTML template that is passed an object with relevant view state.
Source:

resetActiveState()

Remove the active state from this card and all its buttons.
Source:

selectLayers(eopt)

Zoom to the card's location and toggle the relevant layers. Closes any open visualization overlay first. When the clicked button carries a `data-button-index` attribute it is a 'map'-type button; the corresponding action object is forwarded to `selectCallback` so the model can use its specific coordinates and layerIds.
Parameters:
Name Type Attributes Description
e MouseEvent <optional>
The click event, if triggered from the DOM.
Source:

setActive(buttonEl)

Mark this card as active and highlight the specific clicked button.
Parameters:
Name Type Description
buttonEl HTMLElement The button element that was activated.
Source: