r-spatial / leafem

leaflet extensions for mapview
https://r-spatial.github.io/leafem/
Other
108 stars 30 forks source link

removeMouseCoordinates does not return a `mapview` class #88

Open cysouw opened 3 months ago

cysouw commented 3 months ago

The function removeMouseCoordinates returns only part of the mapview object. Maybe better something like this?

removeMouseCoordinates = function(map) {
  if (inherits(map, "mapview")) leaf = map@map

  rc = leaf$jsHooks$render
  rc_lnlt = grepl("lnlt", rc) #lapply(rc, grepl, pattern = "lnlt")
  leaf$jsHooks$render = leaf$jsHooks$render[!rc_lnlt]

  map@map <- leaf
  return(map)
}
tim-salabim commented 3 months ago

All functions provided by leafem are intended to work with native leaflet objects. If anywhere, this should be implemented in mapview as a method for mapview objects.