R/plugin-gps.R

leafletGPSDependencies <- function() {
  list(
    htmltools::htmlDependency(
      "leaflet-gps",
      "0.1.0",
      system.file("htmlwidgets/plugins/leaflet-gps", package = "leafletplugins"),
      script = c('leaflet-gps.min.js', 'leaflet-gps-binding.js'),
      stylesheet = c('leaflet-gps.min.css')
    )
  )
}

#' Add a gps to the Map
#' \url{https://github.com/Norkart/Leaflet-MiniMap}
#'
#' @param map a map widget object
#' @examples
#' leaflet() %>%
#'   addTiles() %>%
#'   addControlGPS()
#' @export
addControlGPS <- function(
  map
) {
  map$dependencies <- c(map$dependencies, leafletGPSDependencies())
  invokeMethod(
    map
    , getMapData(map)
    , 'addControlGPS'
  )
}
asmith26/leafletplugins documentation built on May 5, 2019, 8:01 p.m.