diff --git a/NEWS b/NEWS index 35ec16f0d..7ec90ca55 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ leaflet 2.0.0.9000 BUG FIXES * `.leaflet-map-pane` `z-index` switched to 'auto'. Allows for map panes to appear above the map if they appear later in the dom. (#537) +* Use correct Leaflet.js scale control remove method (#547) + leaflet 2.0.0 -------------------------------------------------------------------------------- diff --git a/inst/htmlwidgets/leaflet.js b/inst/htmlwidgets/leaflet.js index b997ce948..a3fd217b5 100644 --- a/inst/htmlwidgets/leaflet.js +++ b/inst/htmlwidgets/leaflet.js @@ -2058,7 +2058,7 @@ methods.addScaleBar = function (options) { methods.removeScaleBar = function () { if (this.currentScaleBar) { - this.currentScaleBar.removeFrom(this); + this.currentScaleBar.remove(); this.currentScaleBar = null; } }; diff --git a/javascript/src/methods.js b/javascript/src/methods.js index 3dc825626..6a236750d 100644 --- a/javascript/src/methods.js +++ b/javascript/src/methods.js @@ -896,7 +896,7 @@ methods.addScaleBar = function(options) { methods.removeScaleBar = function() { if (this.currentScaleBar) { - this.currentScaleBar.removeFrom(this); + this.currentScaleBar.remove(); this.currentScaleBar = null; } };