Skip to content

Commit b8f176e

Browse files
committed
remove all special characters for homebutton
1 parent eb0ce99 commit b8f176e

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

R/files.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ leaflet_tiles = function(x,
9898
m = leafem::addHomeButton(
9999
m,
100100
ext = raster::extent(ll_mn$lon, ll_mx$lon, ll_mn$lat, ll_mx$lat),
101-
group = layer.name
101+
group = gsub("[[:punct:] ]", "_", layer.name)
102102
)
103103
}
104104
#
@@ -175,7 +175,7 @@ leaflet_file = function(x,
175175
funs <- funs[!sapply(funs, is.null)]
176176

177177
args <- list(if (scalebar) list(position = "bottomleft"),
178-
if (homebutton) list(group = layer.name),
178+
if (homebutton) list(group = gsub("[[:punct:] ]", "_", layer.name)),
179179
if (is.null(map)) list(map.types = map.types,
180180
names = layer.name,
181181
native.crs = native.crs),

R/raster.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ leafletRL = function(x,
157157
if (scalebar) m = leaflet::addScaleBar(m, position = "bottomleft")
158158
m = leafem::addMouseCoordinates(m)
159159
m = leafem::addCopyExtent(m)
160-
if (homebutton) m = leafem::addHomeButton(m, ext, group = layer.name)
160+
if (homebutton) m = leafem::addHomeButton(m, ext, group = gsub("[[:punct:] ]", "_", layer.name))
161161

162162
if (hide) {
163163
m = leaflet::hideGroup(m, layer.name)

R/sf.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ leafgl_sf = function(x,
347347
if (scalebar) list(position = "bottomleft")
348348
, if (homebutton) list(
349349
ext = createExtent(x)
350-
, group = layer.name
350+
, group = gsub("[[:punct:] ]", "_", layer.name)
351351
, position = mapviewGetOption("homebutton.pos")
352352
)
353353
, if (is.null(map)) list(
@@ -672,7 +672,7 @@ leaflet_sfc <- function(x,
672672
if (scalebar) list(position = "bottomleft")
673673
, if (homebutton) list(
674674
ext = createExtent(x)
675-
, group = layer.name
675+
, group = gsub("[[:punct:] ]", "_", layer.name)
676676
, position = mapviewGetOption("homebutton.pos")
677677
)
678678
, if (is.null(map)) list(

R/stars.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ leaflet_stars = function(x,
303303
m = leaflet::addScaleBar(map = m, position = "bottomleft")
304304
m = leafem::addMouseCoordinates(m)
305305
m = leafem::addCopyExtent(m)
306-
if (homebutton) m = leafem::addHomeButton(m, ext, group = layer.name)
306+
if (homebutton) m = leafem::addHomeButton(m, ext, group = gsub("[[:punct:] ]", "_", layer.name))
307307

308308
if (hide) {
309309
m = leaflet::hideGroup(m, layer.name)

0 commit comments

Comments
 (0)