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 by default, while 'iframe'/'tab' type actions (primary ordinality) render as bordered buttons by default. 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

applyImageFallback(img)

Replace a broken hero image with its configured fallback source.
Parameters:
Name Type Description
img HTMLImageElement The image element that failed loading.
Since:
  • 2.38.0
Source:

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

Initialize with card metadata and action callbacks.
Parameters:
Name Type Description
root0 object Initialize options.
Properties
Name Type Attributes Description
preset ViewfinderCardModel Card metadata.
onMapAction function <optional>
Handles map actions.
onIframeAction function <optional>
Handles iframe actions.
onRequestCloseVisualization function <optional>
Closes overlays before actions.
onActivate function <optional>
Marks this card as active.
onActionUiActivated function <optional>
Notifies UI action activation.
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:

restoreAction(action) → {boolean}

Restore an action from URL state without replaying click side effects.
Parameters:
Name Type Description
action ViewfinderCardAction The action object to restore.
Since:
  • 2.38.0
Source:
Returns:
True when restoration succeeded.
Type
boolean

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 `onMapAction` 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, action, optionsopt)

Mark this card as active and highlight the specific clicked button.
Parameters:
Name Type Attributes Description
buttonEl HTMLElement The button element that was activated.
action ViewfinderCardAction The action object associated with the button.
options object <optional>
Additional activation options.
Properties
Name Type Attributes Description
notifyActionActivated boolean <optional>
Whether to notify listeners.
Since:
  • 2.38.0
Source:

wireImageFallbacks()

Wire one-time error handlers for hero images with fallback sources.
Since:
  • 2.38.0
Source: