Closed cmcaine closed 5 months ago
map_shape_click is not triggered in latest leaflet.extras for drawn shapes.
map_shape_click
Tested in v1, v0.2
reprex:
library(leaflet) library(leaflet.extras) library(shiny) ui <- fluidPage( leafletOutput('map'), verbatimTextOutput('summary') ) server <- function(input, output, session) { output$summary <- renderPrint({ event <- input$map_shape_click print(event) }) output$map <- renderLeaflet({ leaflet() %>% addTiles() %>% setView(10, 10, 4) %>% addDrawToolbar( targetGroup = 'draw') }) } shinyApp(ui, server)
Old bug with the same issue: https://github.com/rstudio/leaflet/issues/250
@byzheng perhaps you can explain how you solved this?
Maybe methods.mouseHandler just needs to be called for each drawn feature?
https://github.com/rstudio/leaflet/blob/8b20549eeca9b7b66019f098a380422377666bc6/javascript/src/methods.js#L17
Yep: I just need to call this for each shape. Probably adding to the map.on call here
PR incoming.
map_shape_click
is not triggered in latest leaflet.extras for drawn shapes.Tested in v1, v0.2
reprex:
Old bug with the same issue: https://github.com/rstudio/leaflet/issues/250
@byzheng perhaps you can explain how you solved this?