-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
highlight_color for vector classes #1866
highlight_color for vector classes #1866
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working in this @yschopfer19! I’m on mobile so I haven’t looked into this that detailed yet, but I wanted to share my first thought. Which is that I’d rather avoid adding the repeated code. Maybe you can think of a way to have that extra template code only in one place?
I do like the idea of having highlight functionality on vector classes, but if the code becomes much longer or more complex I’m not sure if it’s worth it.
I hope you’re not discouraged by this. And if you want I can help with this as well later.
thanks again for your effort!
In combination with JsCode this makes it easier for users to add `on` method calls for event handling without extending Folium itself. The functionality was inspired by PR python-visualization#1866 by @yschopfer19. The PR was not accepted yet, because of concerns with code duplication. In the approach taken in the current PR, python-visualization#1866 would not be necessary anymore, as the requested changes could be added completely in client code space.
In combination with JsCode this makes it easier for users to add `on` method calls for event handling without extending Folium itself. The functionality was inspired by PR python-visualization#1866 by @yschopfer19. The PR was not accepted yet, because of concerns with code duplication. In the approach taken in the current PR, python-visualization#1866 would not be necessary anymore, as the requested changes could be added completely in client code space.
* Add EventHandler to layer object In combination with JsCode this makes it easier for users to add `on` method calls for event handling without extending Folium itself. The functionality was inspired by PR #1866 by @yschopfer19. The PR was not accepted yet, because of concerns with code duplication. In the approach taken in the current PR, #1866 would not be necessary anymore, as the requested changes could be added completely in client code space. * Make realtime inherit from Layer * Changes after review comments by conengmo * Updates after review comments * Add extra docstring line * Add Evented class In Leaflet Evented is the parent class of both `L.Map` and `L.Layer`. It adds the `on` method which can be used to add event handlers to a leaflet object. * Update folium/map.py Co-authored-by: Frank Anema <[email protected]> * Update folium/map.py Co-authored-by: Frank Anema <[email protected]> * As requested in review comment --------- Co-authored-by: Frank Anema <[email protected]>
Since #1959 was merged maybe that can be used for this functionality. |
@yschopfer19 By now we implemented #1959, which allows users to add javascript event handlers. It allows users to do what you proposed in your PR. If #1959 does not serve your need, please let us know. |
The implementation introduces the possibility to highlight polylines, polygons, rectangles, circles, and circle markers if a tooltip is shown.
Changes Made:
Related Issue: #1763