easyButton: Create an easyButton statestate

Description Usage Arguments Functions See Also Examples

View source: R/plugin-easybutton.R

Description

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

Usage

1
2
3
4
5
6
7
8
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)

Arguments

stateName

a unique name for the state

icon

the button icon

title

text to show on hover

onClick

the action to take

position

topleft|topright|bottomleft|bottomright

id

id for the button

states

the states

map

a map widget object

button

the button object created with easyButton

...

a list of buttons created with easyButton

Functions

See Also

easyButton

https://github.com/CliffCloud/Leaflet.EasyButton

addEasyButton

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
leaf <- leaflet() %>%
  addTiles() %>%
  addEasyButton(easyButton(
     icon = htmltools::span(class = "star", htmltools::HTML("&starf;")),
     onClick = JS("function(btn, map){ map.setZoom(1);}")))
leaf

leaf <- leaflet() %>%
  addTiles() %>%
  addEasyButtonBar(
   easyButton(
     icon = htmltools::span(class = "star", htmltools::HTML("&starf;")),
     onClick = JS("function(btn, map){ alert(\"Button 1\");}")),
   easyButton(
     icon = htmltools::span(class = "star", htmltools::HTML("&target;")),
     onClick = JS("function(btn, map){ alert(\"Button 2\");}")))
leaf

rstudio/leaflet documentation built on Nov. 2, 2018, 4:48 a.m.