-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Is your feature request related to a problem? Please describe.
I find I sometimes need to patch or extend Folium classes. This is to access Leaflet functionality that would be accessible directly from javascript. Starting as a Leaflet user before moving to Folium I find this annoying at times.
Describe the solution you'd like
The functionality I miss resides in a few classes in the Leaflet class hierarchy. Notably:
- L.Class
- L.Evented
- L.Control
My proposal would be to implement these classes in Folium.
folium.Class will provide the include method, which makes it really easy to customize any Leaflet object.
folium.Evented provides the possibility to add javascript event handlers using on(event=JsCode().
folium.Control factors out the common code for controls.
folium.Class will be a subclass of branca.MacroElement. It will be the parent class for all Leaflet based classes in Folium.
folium.Evented would become a superclass of folium.Layer.
folium.Control will become the superclass for the core folium controls and also for the plugins that now derive from MacroElement and implement a leaflet Conrol.
These changes should be backwards compatible for most uses.
There is already a PR for adding an event handler and for a Leaflet.Control object, #1903 and #1902. If you agree this proposal is a good idea, I will rewrite those PRs, to make them align with the class hierarchy.
Describe alternatives you've considered
So far I have been copying and modifying Folium classes to get what I want.
Implementation
I am willing to implement this.