crosstalk icon indicating copy to clipboard operation
crosstalk copied to clipboard

Hide all others markers in Leaflet map when some markers are highlighted through other widgets

Open oude-gao opened this issue 4 years ago • 2 comments

Hi! Just started using this package, and am trying to combine leaflet with plotly/datatable in a shiny app. The main functionality would be highlighting markers on the leaflet map and see the locations by selecting the points in the plotly scatterplot. However, it's a fairly dense map so even with the other markers dimmed, it's still hard to locate the highlighted ones.

I went into the back-end and found out when highlighting some markers, their opacity/fillOpacity remains the original value, with these two attributes divided by 5 in value to achieve the 'dimming' effect. Is this behavior imported by the leaflet API or crosstalk? It would be great to change it to just giving both attributes a 0 (like what plotly did with the dimOpacity attributes in their highlight function). I couldn't find anything relevant and thought this would be the best place to sought help.

Thanks!!

oude-gao avatar Apr 22 '20 01:04 oude-gao

I think this issue is exactly the same one I'm having. My leaflet map is covered with markers, circles, whatever. I'm currently using R's reactable package to display a table to use for filtering, but the DT package would probably produce the same issue. When I select a single row, I still see too many markers on the map, even though the opacity of the unselected markers is reduced. I would like for all the markers to disappear except for the ones I've chose from the table. Maybe there's a quick fix from leaflet or reactable. But from @oude-gao, it sounds like the ball is in crosstalk's court. Just to be thorough, I will cross reference this in reactable and leaflet. It's definitely deserving of attention.

tedmoorman avatar Feb 13 '21 18:02 tedmoorman

Reactable developer seemed to think that this was a leaflet issue:

glin commented Feb 14, 2021 Hi, I think this is most likely a leaflet thing. reactable only interacts with leaflet through Crosstalk, and doesn't do anything specific for leaflet. Other Crosstalk examples with leaflet seem to work the same too, like at https://rstudio.github.io/crosstalk/index.html. There may be some config option in leaflet to control the unselected marker opacity, so I'd guess the leaflet repo is the best place to ask about it.

Thoughts?

tedmoorman avatar Feb 16 '21 16:02 tedmoorman