Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

How to safely deactivate the plugin/remove from map #14

Open
vvavepacket opened this issue Dec 9, 2017 · 1 comment
Open

How to safely deactivate the plugin/remove from map #14

vvavepacket opened this issue Dec 9, 2017 · 1 comment

Comments

@vvavepacket
Copy link

How do we safely remove the plugin in the map after we use it?

I tried removing it through: map.removeLayer(collisionLayer);, the labels are remove, but the rendering is messedup such that it affects other markers previously loaded on the map.

When I tried zooming, i encounter the following error after removing collisionLayer

Leaflet.LayerGroup.Collision.js:164 Uncaught TypeError: Cannot read property 'getZoom' of null
    at e._onZoomEnd (Leaflet.LayerGroup.Collision.js:164)
    at e.fire (Events.js:186)
    at e._moveEnd (Map.js:1184)
    at e.<anonymous> (Map.js:1628)
@dotevo
Copy link

dotevo commented Sep 25, 2018

It should solve the issue:

onRemove: function (map) { this._map = null; map.off('zoomend', this._onZoomEnd, this); },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants