Unselect map area by clicking it again

This commit is contained in:
2026-01-07 20:20:07 +01:00
parent 85a40b26ca
commit 59e28905ad

View File

@@ -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