Creates a flexible control panel that can contain multiple controls.
Usage
add_control_panel(
map,
panel_id,
title = NULL,
position = "bottom-left",
collapsible = FALSE,
collapse_config = list(),
direction = "column",
custom_controls = NULL
)Arguments
- map
The map or map proxy object.
- panel_id
Unique identifier for the control panel.
- title
Title for the control panel. If NULL, no title is shown.
- position
Position of the control panel on the map. Default is "bottom-left". Options include "top-left", "top-right", "bottom-left", "bottom-right".
- collapsible
Whether the panel can be collapsed. Default is FALSE.
- collapse_config
List of configuration options for the collapsible behavior.
collapsed: Initial collapsed state. Default is FALSE.collapseVertically: Whether the panel collapses vertically (TRUE) or horizontally (FALSE). Default is TRUE.openIcon: HTML string for the icon when the panel is open. Default is a simple arrow.collapsedIcon: HTML string for the icon when the panel is collapsed. Default is a simple arrow.
- direction
Layout direction for controls within the panel. Either "row" or "column". Default is "column".
- custom_controls
List of custom controls to add initially. Each should be a list with elements: html, id (optional), title (optional).
Examples
map() |>
add_control_panel(panel_id = "my_panel", title = "Map Settings") |>
add_cursor_coords_control(panel_id = "my_panel") |>
add_zoom_control(panel_id = "my_panel")
map() |>
add_control_panel(
panel_id = "my_panel",
title = "Map Settings",
position = "top-right",
collapsible = TRUE,
collapse_config = list(collapsed = TRUE),
direction = "row"
) |>
add_cursor_coords_control(
panel_id = "my_panel",
section_title = "Cursor Coordinates"
)
