rstudio / leaflet

R Interface to Leaflet Maps
http://rstudio.github.io/leaflet/
Other
805 stars 509 forks source link

EasyButtonBar does not position correctly #465

Open ghost opened 7 years ago

ghost commented 7 years ago

Not sure if this is an error or bug, but my attempts to move a EasyButtonBar from it's default location (topleft) to elsewhere are not succeeding. It allways gets positioned topleft.

I'm talking about the command addEasyButtonBar(...,position = 'topright').

Working example:

  library(shiny)
  library(leaflet)

 ui <- fluidPage(leafletOutput("map"))

server <- function(input, output, session) {
output$map <- renderLeaflet({
leaflet() %>%
  addProviderTiles(providers$Stamen.TonerLite,
                   options = providerTileOptions(noWrap = TRUE)) %>%

  addEasyButtonBar(
  easyButton(
      icon = "fa-crosshairs",
      title = "Locate Me",
      onClick = JS(
        c(
          "function(btn,  map){map.locate({setView:true,enableHighAccuracy: true })}"
        )
      )
    ),

    easyButton(
      icon = "fa-home",
      title = "Another button",
      onClick = JS(
        c(
          "function(btn,  map){map.locate({setView:true,enableHighAccuracy: true })}"
        )
      )
    )
    ,position = "topright")
   })
  }

 shinyApp(ui, server)
bhaskarvk commented 7 years ago

Thanls for reporting, I will check it out.