diff --git a/libs/leaflet-hotline.js b/libs/leaflet-hotline.js index ac95604..1684560 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 d47218f..e49fbe5 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 = [];