# NOT RUN {
library(leaflet)
leaflet(options = leafletOptions(
contextmenu = TRUE,
contextmenuWidth = 200,
contextmenuItems =
mapmenuItems(
menuItem("Zoom Out", "function(e) {this.zoomOut()}", disabled=FALSE),
"-",
menuItem("Zoom In", "function(e) {this.zoomIn()}")))) %>%
addTiles(group = "base") %>%
addContextmenu() %>%
addMarkers(data = breweries91, label = ~brewery,
layerId = ~founded, group = "marker",
options = markerOptions(
contextmenu = TRUE,
contextmenuWidth = 200,
contextmenuItems =
markermenuItems(
menuItem(text = "Show Marker Coords",
callback = "function(e) {alert(e.latlng);}",
index = 1)
)
))
# }
Run the code above in your browser using DataLab