Learn R Programming

linkeR (version 0.1.2)

apply_default_leaflet_behavior: Apply Default Leaflet Behavior for Selection Events

Description

apply_default_leaflet_behavior is a helper function that provides consistent default behavior for leaflet maps when handling selection events. It manages popup display and map navigation based on the selection state.

Usage

apply_default_leaflet_behavior(map_proxy, selected_data, component_info)

Value

Returns the modified map proxy object with updated view and popups

Arguments

map_proxy

A leaflet map proxy object used to update the map

selected_data

A data frame or list containing the selected row/item data. If NULL, indicates deselection occurred.

component_info

A list containing component configuration information:

shared_id_column

Character. Name of the column containing unique identifiers

config

List containing:

lng_col

Character. Name of the longitude column

lat_col

Character. Name of the latitude column

highlight_zoom

Numeric. Zoom level to use when highlighting selection

Details

When selected_data is provided:

  • Creates a popup with "Selected" header and ID information

  • Sets map view to the selected location coordinates

  • Applies the configured highlight zoom level

When selected_data is NULL (deselection):

  • Removes all existing popups from the map