Create an easyButton statestate
Creates an easy button.
Add a EasyButton on the map see https://github.com/CliffCloud/Leaflet.EasyButton
Add a easyButton bar on the map see https://github.com/CliffCloud/Leaflet.EasyButton
easyButtonState(stateName, icon, title, onClick)
easyButton(
icon = NULL,
title = NULL,
onClick = NULL,
position = "topleft",
id = NULL,
states = NULL
)
addEasyButton(map, button)
addEasyButtonBar(map, ..., position = "topleft", id = NULL)
a unique name for the state
the button icon
text to show on hover
the action to take
topleft|topright|bottomleft|bottomright
id for the button
the states
a map widget object
the button object created with easyButton
a list of buttons created with easyButton
easyButtonState
: state of an easyButton.
addEasyButton
: add an EasyButton to the map
addEasyButtonBar
: add an EasyButton to the map
leaf <- leaflet() %>%
addTiles() %>%
addEasyButton(easyButton(
icon = htmltools::span(class = "star", htmltools::HTML("★")),
onClick = JS("function(btn, map){ map.setZoom(1);}")))
leaf
leaf <- leaflet() %>%
addTiles() %>%
addEasyButtonBar(
easyButton(
icon = htmltools::span(class = "star", htmltools::HTML("★")),
onClick = JS("function(btn, map){ alert(\"Button 1\");}")),
easyButton(
icon = htmltools::span(class = "star", htmltools::HTML("⌖")),
onClick = JS("function(btn, map){ alert(\"Button 2\");}")))
leaf