Skip to content

Commit

Permalink
set leaflet interactive to FALSE if popup and hover is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
mtennekes committed Nov 22, 2024
1 parent 088c602 commit 72c1edf
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions R/tmapLeaflet_layers.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ tmapLeafletPolygons = function(shpTM, dt, pdt, popup.format, hdt, idt, gp, bbx,
gp = impute_gp(gp, dt)
gp = rescale_gp(gp, o$scale_down)

opt = leaflet::pathOptions(interactive = TRUE, pane = pane)

interactive = (!is.null(pdt) || !is.null(hdt))

opt = leaflet::pathOptions(interactive = interactive, pane = pane)

idt = (if (is.null(idt))dt$tmapID__ else idt) |>
submit_labels("polygons", pane, group)
Expand Down Expand Up @@ -207,7 +210,9 @@ tmapLeafletLines = function(shpTM, dt, pdt, popup.format, hdt, idt, gp, bbx, fac
gp = impute_gp(gp, dt)
gp = rescale_gp(gp, o$scale_down)

opt = leaflet::pathOptions(interactive = TRUE, pane = pane)
interactive = (!is.null(pdt) || !is.null(hdt))

opt = leaflet::pathOptions(interactive = interactive, pane = pane)

idt = (if (is.null(idt))dt$tmapID__ else idt) |>
submit_labels("lines", pane, group)
Expand Down Expand Up @@ -290,7 +295,9 @@ tmapLeafletSymbols = function(shpTM, dt, pdt, popup.format, hdt, idt, gp, bbx, f
submit_labels("symbols", pane, group)


opt = leaflet::pathOptions(interactive = TRUE, pane = pane)
interactive = (!is.null(pdt) || !is.null(hdt))

opt = leaflet::pathOptions(interactive = interactive, pane = pane)

gp2 = gp_to_lpar(gp, mfun = "Symbols", size_factor = 14) # 14 based on similarity with plot mode and consistency with tmap3
#gp = gp2leafgp(gp)
Expand Down Expand Up @@ -522,8 +529,7 @@ tmapLeafletText = function(shpTM, dt, gp, bbx, facet_row, facet_col, facet_page,
idt = dt$tmapID__[shpTM_match] |>
submit_labels("text", pane, group)


opt = leaflet::pathOptions(interactive = TRUE, pane = pane)
opt = leaflet::pathOptions(interactive = FALSE, pane = pane)



Expand Down

0 comments on commit 72c1edf

Please sign in to comment.