Skip to content

Commit

Permalink
Hide search marker/object when closing sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh authored and tomhughes committed Aug 6, 2013
1 parent c6cde26 commit a1af4d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/assets/javascripts/index/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ function initializeSearch(map) {
});

openSidebar();

$("#sidebar").one("closed", function () {
map.removeLayer(marker);
map.removeObject();
});
}

function clickSearchResult(e) {
Expand Down
6 changes: 6 additions & 0 deletions app/assets/javascripts/leaflet.extend.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ L.extend(L.Map.prototype, {
map._objectLayer.addTo(map);
}
});
},

removeObject: function() {
this._object = null;
if (this._objectLoader) this._objectLoader.abort();
if (this._objectLayer) this.removeLayer(this._objectLayer);
}
});

Expand Down

0 comments on commit a1af4d5

Please sign in to comment.