From 96413d970c4bb4cc0108ca26b47ad27990b45b9e Mon Sep 17 00:00:00 2001 From: Frank <33519926+Conengmo@users.noreply.github.com> Date: Sat, 8 Apr 2023 12:10:05 +0200 Subject: [PATCH] MeasureControl: workaround for Leaflet>=1.8.0 --- folium/plugins/measure_control.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/folium/plugins/measure_control.py b/folium/plugins/measure_control.py index 239d10a972..4b543dc2f5 100644 --- a/folium/plugins/measure_control.py +++ b/folium/plugins/measure_control.py @@ -28,6 +28,21 @@ class MeasureControl(JSCSSMixin, MacroElement): {{ this.options|tojson }}); {{this._parent.get_name()}}.addControl({{this.get_name()}}); + // Workaround for using this plugin with Leaflet>=1.8.0 + // https://github.com/ljagis/leaflet-measure/issues/171 + L.Control.Measure.include({ + _setCaptureMarkerIcon: function () { + // disable autopan + this._captureMarker.options.autoPanOnFocus = false; + // default function + this._captureMarker.setIcon( + L.divIcon({ + iconSize: this._map.getSize().multiplyBy(2) + }) + ); + }, + }); + {% endmacro %} """ ) # noqa