Open
Description
In my shiny-app, i've got a leaflet, based on reactive userinput
output$leafletMap2 <- renderLeaflet({
leaflet(df[which(!is.na(df$latitude)), ]) %>% addTiles() %>% setView(4.213, 51.876, zoom = 7)
})
observe({
leafletProxy("leafletMap2", data = filteredData() ) %>%
clearGroup("test1") %>%
clearGroup("test2") %>%
clearGroup("test3") %>%
addCircleMarkers(lng = ~longitude,
lat = ~latitude,
radius = 6,
color = ~pal(process),
stroke = FALSE,
fillOpacity = 1,
popup = paste(filteredData()$time, "<br>", filteredData()$description),
popupOptions = popupOptions(closeOnClick = FALSE),
group = "test1") %>%
addCircleMarkers(lng = ~longitude,
lat = ~latitude,
radius = 6,
color = ~pal(PROCES),
stroke = FALSE,
fillOpacity = 1,
clusterOptions = markerClusterOptions() ,
popup = paste(filteredData()$time, "<br>", filteredData()$description),
popupOptions = popupOptions(closeOnClick = FALSE),
group = "test2") %>%
addHeatmap(lng = ~longitude,
lat = ~latitude,
blur = 15,
max = 1,
radius = 10,
intensity = 0.25,
group = "test3") %>%
clearControls() %>%
addLegend(position = "bottomleft",
pal = pal,
values = sort( unique(filteredData()$PROCES) ),
opacity = 1,
group = "test1") %>%
addLayersControl(baseGroups = c("test3", "test1", "test2"),
#overlayGroups = c("test3", "test1", "test2"),
options = layersControlOptions(collapsed = FALSE)
)
})
I would like the legend to show only when test3 is the selected layer. This does not work when I select a layer from the baseGroups (with radiobuttons). However, it does work when I add the laters to the overlayGroups (with checkboxes). I rather do not want to do that, because I want the user not to be able to select multiple layers at once).
Not sure if this is a bug-report, feature request or that I'm simply missing somthing ;-).