Skip to content

Commit

Permalink
prevent crash when all filters deselected
Browse files Browse the repository at this point in the history
  • Loading branch information
RWParsons committed Jun 11, 2024
1 parent db713fb commit 9b03e02
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions app/app/mapping/update_map_content.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,29 @@ show_polygon <- function(proxy_map, d_selection, r_layers) {

fcolor_palette <- scales_and_palettes$get_palette(d_selection$outcome)

proxy_map |>
leaflet$hideGroup(grp_add) |>
leafgl$addGlPolygons(
data = poly_add,
pane = "layers",
group = grp_add,
popup = poly_add$selected_popup,
fillColor = fcolor_palette(poly_add$selected_col)
) |>
leafgl$addGlPolylines(
data = linestring_add,
group = grp_add,
color = "black",
weight = 0.1,
opacity = 0.5
)
proxy_map |> leaflet$hideGroup(grp_add)

if (nrow(poly_add) > 1) {
proxy_map |>
leafgl$addGlPolygons(
data = poly_add,
pane = "layers",
group = grp_add,
popup = poly_add$selected_popup,
fillColor = fcolor_palette(poly_add$selected_col)
)
}

if (nrow(linestring_add) > 1) {
proxy_map |>
leafgl$addGlPolylines(
data = linestring_add,
group = grp_add,
color = "black",
weight = 0.1,
opacity = 0.5
)
}

proxy_map |>
leaflet$showGroup(grp_add) |>
Expand Down

0 comments on commit 9b03e02

Please sign in to comment.