AddEasyButton() Leaflet-Shiny custom Icon

leaflet

#1

Hi there,

I'm trying to add an easyButton to my Leaflet map and use a custom icon image via

makeIcon()

However when I do:

addEasyButton(easyButton(title ="Earthquakes",
                               position = "topleft",
                               id="earthquakeButton",
                               icon=makeIcon(iconUrl="www/icons8-earthquakes-50.png"),
                               onClick = JS("function(btn, map)
                                            {Shiny.onInputChange(\"earthquakePressed\",
                                            {thing:Math.random()});}")))

All I get is a blank icon with no errors in the console:

icon_no_dimensions

And when I try with dimensions:

addEasyButton(easyButton(title ="Earthquakes",
                               position = "topleft",
                               id="earthquakeButton",
                               icon=makeIcon(iconUrl="www/icons8-earthquakes-50.png",
                                             iconHeight = 50,
                                             iconWidth = 50),
                               onClick = JS("function(btn, map)
                                            {Shiny.onInputChange(\"earthquakePressed\",
                                            {thing:Math.random()});}")))

I get no icon:

icon_with_dimensions

But this in the console:

Warning in if (grepl("fa-", button$icon)) map$dependencies <- c(map$dependencies,  :
  the condition has length > 1 and only the first element will be used
Warning in if (grepl("glyphicon-", button$icon)) map$dependencies <- c(map$dependencies,  :
  the condition has length > 1 and only the first element will be used
Warning in if (grepl("ion-", button$icon)) map$dependencies <- c(map$dependencies,  :
  the condition has length > 1 and only the first element will be used

Any suggestions?

Many thanks,

Ciaran