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
layersupport + freezable #13
Comments
Hi, Thank you for your message. Indeed it looks like the naming collision on By using a workaround to prevent this naming collision, all seems the work correctly: // Modify _originalOnAdd before LayerSupport kicks in, in order to prevent naming collision.
L.MarkerClusterGroup.include({
// Original onAdd is already stored in _originalOnAdd and replaced in onAdd by Freezable plugin.
_originalOnAddFreezable: L.MarkerClusterGroup.prototype._originalOnAdd,
onAdd: function(map) {
var frozenZoom = this._zoom;
// Use the new name for the original onAdd.
this._originalOnAddFreezable(map);
// Rest of method is unchanged compared to Freezable plugin.
if (this._frozen) {
// Restore the specified frozenZoom if necessary.
if (frozenZoom >= 0 && frozenZoom !== this._zoom) {
// Undo clusters and markers addition to this._featureGroup.
this._featureGroup.clearLayers();
this._zoom = frozenZoom;
this.addLayers([]);
}
// Replace the callbacks on zoomend and moveend events.
map.off('zoomend', this._zoomEnd, this);
map.off('moveend', this._moveEnd, this);
map.on('zoomend moveend', this._viewChangeEndNotClustering, this);
}
}
}); Live demo: http://playground-leaflet.rhcloud.com/rono/1/edit?html,output Versions:
|
Perfect, thanks so much for the response and more importantly thanks for your efforts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks so much for all your work on this. Is there any way to use layersupport and freezable together/simultaneously?
The text was updated successfully, but these errors were encountered: