leaflet.extras
leaflet.extras copied to clipboard
`map_shape_click` not emitted when clicking on drawn shapes (v1, v0.2)
map_shape_click
is not triggered in latest leaflet.extras for drawn shapes.
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