Skip to content

Commit

Permalink
Move this._layer initialization to _initialDraw
Browse files Browse the repository at this point in the history
This fixes a bug where, when the location filter was added,
removed, and re-added to a map, it would not display. This
happened because the re-add would reinitialize this._layer
but not call _initialDraw, which sets up this._layer.
  • Loading branch information
jfirebaugh committed Oct 9, 2013
1 parent 94c74da commit 2ece0c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/locationfilter.js
Expand Up @@ -114,7 +114,6 @@ L.LocationFilter = L.Class.extend({


onAdd: function(map) { onAdd: function(map) {
this._map = map; this._map = map;
this._layer = new L.LayerGroup();


if (this.options.enableButton || this.options.adjustButton) { if (this.options.enableButton || this.options.adjustButton) {
this._initializeButtonContainer(); this._initializeButtonContainer();
Expand Down Expand Up @@ -285,6 +284,8 @@ L.LocationFilter = L.Class.extend({
return; return;
} }


this._layer = new L.LayerGroup();

// Calculate filter bounds // Calculate filter bounds
this._calculateBounds(); this._calculateBounds();


Expand Down

0 comments on commit 2ece0c3

Please sign in to comment.