From 2712268935994067eec4c79585092e9d5034c068 Mon Sep 17 00:00:00 2001 From: Raruto Date: Tue, 25 Apr 2023 02:35:30 +0200 Subject: [PATCH] close: https://github.com/Raruto/leaflet-elevation/issues/233 --- libs/leaflet-hotline.js | 2 +- src/control.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/leaflet-hotline.js b/libs/leaflet-hotline.js index ac95604e..1684560b 100644 --- a/libs/leaflet-hotline.js +++ b/libs/leaflet-hotline.js @@ -42,7 +42,7 @@ https://github.com/iosphere/Leaflet.hotline/ 1.0: 'red' }; - this._canvas = canvas = typeof canvas === 'string' + this._canvas = canvas = ('string' === typeof canvas) ? document.getElementById(canvas) : canvas; diff --git a/src/control.js b/src/control.js index d47218f1..e49fbe50 100644 --- a/src/control.js +++ b/src/control.js @@ -66,6 +66,7 @@ export const Elevation = L.Control.Elevation = L.Control.extend({ if (this._layers) this._clearLayers(this._layers); if (this._markers) this._clearLayers(this._markers); if (this._circleMarkers) this._circleMarkers.remove(); + if (this._hotline) this._hotline.eachLayer(l => l.options.renderer.remove()); // hotfix for: https://github.com/Raruto/leaflet-elevation/issues/233 if (this._hotline) this._clearLayers(this._hotline); this._data = [];