Unselect map area by clicking it again
This commit is contained in:
8
server.R
8
server.R
@@ -96,6 +96,14 @@ server <- function(input, output, session) {
|
||||
click_event <- input$hhmap_shape_click
|
||||
# Check if an ID was returned (meaning a polygon was clicked)
|
||||
if (!is.null(click_event$id)) {
|
||||
if(click_event$group == "selected") {
|
||||
# Clicked on an already selected area of the map therefore we unselect.
|
||||
currently_selected_bezirk("")
|
||||
currently_selected_stadtteil("")
|
||||
leafletProxy("hhmap") %>%
|
||||
clearGroup("selected")
|
||||
return()
|
||||
}
|
||||
|
||||
# The ID of the clicked polygon
|
||||
clicked_polygon_id <- click_event$id
|
||||
|
||||
Reference in New Issue
Block a user