Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants