-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addPolygons() now responds to crosstalk events #391
base: main
Are you sure you want to change the base?
Conversation
Nice! So in theory this should work for all shapes like rectangles, circles, circleMarkers, polylines, right ? provided code for each of these shapes is changed accordingly. |
I was originally thinking polygon brushing would be really hard to implement, because it'd either have to work by 1) any intersection between the brushing rectangle and the polygon, or 2) complete coverage of the polygon by the brushing rectangle. But a nice easier-to-implement alternative would be 3) the brushing rectangle includes the center-of-mass of the polygon (is that the right term for it?). I believe there are fast routines to do this in R? |
I mean, obviously the correct term is "centroid" not center-of-mass, and obviously it's just the arithmetic mean of all of the points in the polygon. :) |
Yea, that sounds reasonable, and maybe we could leverage |
For irregular polygons centroids can fall out of the polygon/s. |
The mapbox solution is really interesting. I can see how it would be much better than centroid for labeling but I'd want to try out both for brushing to see how they feel. |
Yup agreed. |
We can decompose to triangles for finer elements, as illustrated in my sfdct package. License is a problem but in time we might get CGAL or another alternative. |
Also fwiw this is what I was going after here: https://twitter.com/mdsumner/status/830380049815597056 |
We could make very good use of this pull request. Is there anything we can help with so that it can be accepted? |
@krlmlr this PR only implements the ability for leaflet polygons to respond to crosstalk events. I'm pretty sure @jcheng5 hesitated to take this on initially because ideally, when this is added, you'd also have the ability to brush polygons to emit crosstalk events (which is what most of the comments are about). If you wanted to take a stab at implementing that, I'm pretty sure that'd increase the chances of this landing |
Yeah that would help a lot. Even “just” using the centroid algorithm. |
FWIW, @timelyportfolio came up with this some time ago to enable this kind of thing. Maybe that could serve as a basis for implementation. In action here: |
Responding to crosstalk events is good enough for our use case. I intend to respond to I think it would be useful to enable this for all other shape types, we could file an issue to implement brushing at some point if necessary. I haven't found a documentation of this limitation -- why we can crosstalk points but not polygons -- where can we document it? |
I'm also missing the ability to select/deselect individual objects in the crosstalk framework, this doesn't seem to work neither with leaflet nor with plotly. Has this been considered? |
Hello, I have found quite a few projects that would benefit from this. It works really well but it is not in the main rstudio/leaflet branch. Is there any reason there's a hangup in merging? I am happy to help if I can be pointed in the right direction. |
For example,
TODO:
addPolylines()
etc?Any feedback/input is greatly appreciated :)