| clear_controls | R Documentation |
This function allows you to remove specific controls or all controls from a map.
You can target controls by their type names, which correspond to the function
names used to add them (e.g., "navigation" for controls added with add_navigation_control).
clear_controls(map, controls = NULL)
map |
A map object created by the |
controls |
A character vector of control types to remove, or NULL to remove all controls. Control types include: "navigation", "draw", "fullscreen", "scale", "geolocate", "geocoder", "layers", "reset", "globe_minimap", or custom control IDs. If NULL (default), all controls will be removed. |
The modified map object with specified controls removed.
## Not run:
library(shiny)
library(mapgl)
# Clear all controls
maplibre_proxy("map") |>
clear_controls()
# Clear specific controls
maplibre_proxy("map") |>
clear_controls("navigation")
# Clear multiple controls
maplibre_proxy("map") |>
clear_controls(c("draw", "navigation"))
# Clear a custom control by ID
maplibre_proxy("map") |>
clear_controls("my_custom_control")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.