Skip to content

Commit

Permalink
Additional feature highlighting logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcbride committed Jan 16, 2015
1 parent a315d4b commit 73155ea
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions assets/js/app.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
var map, featureList, boroughSearch = [], theaterSearch = [], museumSearch = [];

$(document).on("click", ".feature-row", function(e) {
$(document).off("mouseout", ".feature-row", clearHighlight);
sidebarClick(parseInt($(this).attr("id"), 10));
});

$(document).on("mouseover", ".feature-row", function(e) {
highlight.clearLayers().addLayer(L.circleMarker([$(this).attr("lat"), $(this).attr("lng")], highlightStyle));
});

$(document).on("mouseout", ".feature-row", function(e) {
highlight.clearLayers();
});
$(document).on("mouseout", ".feature-row", clearHighlight);

$("#about-btn").click(function() {
$("#aboutModal").modal("show");
Expand Down Expand Up @@ -58,6 +57,10 @@ $("#sidebar-hide-btn").click(function() {
map.invalidateSize();
});

function clearHighlight() {
highlight.clearLayers();
}

function sidebarClick(id) {
var layer = markerClusters.getLayer(id);
map.setView([layer.getLatLng().lat, layer.getLatLng().lng], 17);
Expand Down Expand Up @@ -493,6 +496,10 @@ $("#searchbox").keypress(function (e) {
}
});

$("#featureModal").on("hidden.bs.modal", function (e) {
$(document).on("mouseout", ".feature-row", clearHighlight);
});

/* Typeahead search functionality */
$(document).one("ajaxStop", function () {
$("#loading").hide();
Expand Down

0 comments on commit 73155ea

Please sign in to comment.