leaflet.extras icon indicating copy to clipboard operation
leaflet.extras copied to clipboard

add new draw options, fix for removeDrawToolbar

Open trafficonese opened this issue 4 years ago • 5 comments

Adds handlersOptions and toolbarOptions for addDrawToolbar which let you customize the drawing toolbar / tooltips.

This should close #174

This should also close #148, close #156 and close #165 . The function removeFrom did not exist and was changed to remove and the typo drawToobar was corrected to drawToolbar

trafficonese avatar Jan 30 '20 17:01 trafficonese

Sorry for my ignorance, I'm really new to github... Are these fixes ready to use with the package, or going to be merged with the main branch soon? When that happens will I only need to update the package to be able to use them?

Thanks so much for all your work on this!

claysa avatar Mar 25 '20 01:03 claysa

Unfortunately the package is not well maintained at the moment. Please read the comments of #188.

As soon as the PR is merged, you can install the new version with remotes::install_github("bhaskarvk/leaflet.extras") and once it is published to CRAN, you can run install.packages("leaflet.extras").

If you want to try the PR already, you can install it with remotes::install_github("bhaskarvk/leaflet.extras", ref = remotes::github_pull("184"))

trafficonese avatar Mar 25 '20 09:03 trafficonese

I'm trying the PR and so far so good, this is exactly what I was looking for. Thanks!

claysa avatar Mar 25 '20 23:03 claysa

Hi, I have installed the PRs above - I tried both rsion with remotes::install_github("bhaskarvk/leaflet.extras") and remotes::install_github("bhaskarvk/leaflet.extras", ref = remotes::github_pull("184"))

however neither of them fixed the removeDrawToolbar , with or without clearfeatures =T.

do I understand correctly that using this PR it should be possible to remove the toolbar and the drawn polyong featrue using the following?

leafletProxy('mymap')%>% removeDrawToolbar(clearFeatures = T)

nevilamos avatar Jun 02 '20 12:06 nevilamos

Yes, using this PR it should be possible to remove the draw-toolbar and the drawn shapes. This example works for me:

library(shiny)  
library(leaflet)
library(leaflet.extras)

ui <- fluidPage(
  leafletOutput("map"),
  actionButton("rm", "Remove Draw Toolbar")
)

server <- function(input, output, session) {
  output$map <- renderLeaflet({
    leaflet()  %>% 
      addTiles() %>% 
      addDrawToolbar()
  })
  
  observeEvent(input$rm, {
    leafletProxy('map')%>%
      removeDrawToolbar(clearFeatures = T)
  })
}
shinyApp(ui, server)

trafficonese avatar Jun 03 '20 09:06 trafficonese