mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-23 00:14:09 +00:00
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:

committed by
Vladimir Agafonkin

parent
0603741cf7
commit
1e2e1c83ea
@ -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
|
||||
|
@ -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');
|
||||
|
Reference in New Issue
Block a user