Skip to content

Commit ded23e2

Browse files
authored
MeasureControl: workaround for Leaflet>=1.8.0 (#1748)
1 parent 32d65f4 commit ded23e2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

folium/plugins/measure_control.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ class MeasureControl(JSCSSMixin, MacroElement):
2828
{{ this.options|tojson }});
2929
{{this._parent.get_name()}}.addControl({{this.get_name()}});
3030
31+
// Workaround for using this plugin with Leaflet>=1.8.0
32+
// https://github.com/ljagis/leaflet-measure/issues/171
33+
L.Control.Measure.include({
34+
_setCaptureMarkerIcon: function () {
35+
// disable autopan
36+
this._captureMarker.options.autoPanOnFocus = false;
37+
// default function
38+
this._captureMarker.setIcon(
39+
L.divIcon({
40+
iconSize: this._map.getSize().multiplyBy(2)
41+
})
42+
);
43+
},
44+
});
45+
3146
{% endmacro %}
3247
"""
3348
) # noqa

0 commit comments

Comments
 (0)