Learn R Programming

leaflet.extras (version 2.0.1)

addStyleEditor: Add style editor

Description

Add style editor

Remove style editor

Usage

addStyleEditor(
  map,
  position = c("topleft", "topright", "bottomleft", "bottomright"),
  openOnLeafletDraw = TRUE,
  useGrouping = FALSE,
  ...
)

removeStyleEditor(map)

Arguments

map

the map widget

position

position of the control

openOnLeafletDraw

whether to open automatically when used with addDrawToolbar()

useGrouping

Should be false to work with addDrawToolbar()

...

other options. See plugin code

Examples

Run this code
leaflet() %>%
  setView(0, 0, 2) %>%
  addProviderTiles(providers$CartoDB.Positron) %>%
  addDrawToolbar(
    targetGroup = "draw",
    editOptions = editToolbarOptions(selectedPathOptions = selectedPathOptions())
  ) %>%
  addLayersControl(
    overlayGroups = c("draw"), options = layersControlOptions(collapsed = FALSE)
  ) %>%
  # add the style editor to alter shapes added to map
  addStyleEditor()

Run the code above in your browser using DataLab