Create a new base class Control, which can be used to more easily create new control based plugins.
Update the original CustomControl so that it also accepts a style parameter.
Change all the plugins that create L.Control subclasses to use Control as a base class.
This is to some extent a work-in-progress. Once https://github.com/python-visualization/folium/pull/1898 is merged I can make Control inherit from JSCSSMixin and remove that class from all the plugins and just use the inherited method from JSCSSMixin inheritance to add stylesheets and javascript.
Furthermore, many of the plugins could be simplified. In the current implementation options are very often coded in the _Template. By using the Control base class and JsCode parameters as part of the specified options we can avoid that. Or, at least, we can move flow code from the Jinja templates into the __init__ method, which is cleaner.
Also, I tried to make map.LayerControl as subclass of Control, but that resulted in circular dependencies.
I did not do everything at once, because I want to take small steps and check if everything stays backward compatible.
Based on the original draft by @Conengmo
Control
, which can be used to more easily create new control based plugins.CustomControl
so that it also accepts astyle
parameter.L.Control
subclasses to useControl
as a base class.This is to some extent a work-in-progress. Once https://github.com/python-visualization/folium/pull/1898 is merged I can make
Control
inherit fromJSCSSMixin
and remove that class from all the plugins and just use the inherited method fromJSCSSMixin
inheritance to add stylesheets and javascript.Furthermore, many of the plugins could be simplified. In the current implementation
options
are very often coded in the_Template
. By using theControl
base class andJsCode
parameters as part of the specifiedoptions
we can avoid that. Or, at least, we can move flow code from the Jinja templates into the__init__
method, which is cleaner.Also, I tried to make
map.LayerControl
as subclass ofControl
, but that resulted in circular dependencies.I did not do everything at once, because I want to take small steps and check if everything stays backward compatible.