Using the RStudio Leaflet package in a brilliant application, I was able to fulfill all the functionality I was looking for, with the exception of deselecting the marker object after clicking it.
In particular, the input value of $ map_click_id is set to NULL before clicking any markers. When you click on a marker, it is updated with the data (ID, lat, lng, nonce) for that marker. I would like to configure the map so that when the user clicks on any area of ββthe map that is not a marker, enter $ map_click_id reset to NULL until another marker is pressed.
I tried a number of solutions to solve such problems, such as comparing click times for marker clicks and map clicks, but the marker click variable, when it is set to a value other than NULL, is updated every time the map is clicked, regardless whether it is on the marker or not, so this does not work.
Any help here would be greatly appreciated! The following is a very minimal reproducible example. In this case, I would like the marker information to be printed to the console when it is pressed, and for NULL - to the console when any marker area on the map is clicked.
library(leaflet) library(shiny)
This seems to be the same question as here , but since there was no answer to this question, I thought I would try again.
source share