title: Coordinates of current mouse position on leaflet map with shiny
body: <p>I want to access the current mouse position in a leaflet map in shiny. When using shiny you can get  the current coordinates of a click event using <code>input$MAPID_click</code>, which contains latitude and longitude of the click. Similarly I want to have <code>input$MAPID_mouseover</code> with a list of the current latitude and longitude of the mouse cursor.</p>
  
  <p><code>mapview::addMouseCoordinates(map)</code> displays the coordinates in the leaflet map. It uses map.latlng.lng and map.latlng.lat, but I couldn't figure out, how to adapt the code to return a list with the coordinates instead of displaying them.</p>
  
  <p>Ideally this code should work:</p>
  
  <pre><code>library(shiny)
  library(leaflet)
  
  ui &lt;- fluidPage(
    leafletOutput("map"),
    br(),
    verbatimTextOutput("out")
  )
  
  server &lt;- function(input, output, session) {
    output$map &lt;- renderLeaflet({
      leaflet() %&gt;% addTiles()
    })
  
    output$out &lt;- renderPrint({
      validate(need(input$map_mouseover, FALSE))
      str(input$map_mouseover)
    })
  }
  
  shinyApp(ui, server)
  </code></pre>