fix(Map): rm moveend listener from setMaxBounds (#6958)

Calling `map.setMapBounds`, adds the `"moveend"` event listener
`_panInsideMaxBounds`. Previously, this did not get cleaned up via
`remove`.
This commit is contained in:
Simon Legner
2020-01-08 13:26:56 +01:00
committed by Vladimir Agafonkin
parent 0603741cf7
commit 1e2e1c83ea
2 changed files with 2 additions and 1 deletions

View File

@ -72,7 +72,7 @@ describe("Map", function () {
it("does not throw if removed during animation", function () {
var container = document.createElement('div'),
map = new L.Map(container).setView([0, 0], 1);
map = new L.Map(container).setView([0, 0], 1).setMaxBounds([[0, 1], [2, 3]]);
// Force creation of animation proxy,
// otherwise browser checks disable it

View File

@ -752,6 +752,7 @@ export var Map = Evented.extend({
remove: function () {
this._initEvents(true);
this.off('moveend', this._panInsideMaxBounds);
if (this._containerId !== this._container._leaflet_id) {
throw new Error('Map container is being reused by another instance');