Commit f3fc19d7 authored by Elijah Byrd's avatar Elijah Byrd
Browse files

Finishing merge of lazyShimLoad branch

parents 7101cd2c 3c3e0848
......@@ -4,7 +4,6 @@
function load_accessible_gmaps(){
var accessible_gmaps = {};
// TODO: properly isolate these global variables so they don't cause trouble when dropped into other sites
accessible_gmaps.markers = [];
accessible_gmaps.infowindowsEnabled;
accessible_gmaps.map;
......@@ -177,9 +176,20 @@
jQuery('div#map-controls').after('<div id="' + markerID + '" title="' + title + '" class="map-marker" tabindex="0"><span>' + title + '</span></div>');
jQuery('div#' + markerID).data('markerID', markerIndex) // Data attribute is added to the div so its associated marker can be identified.
// Bind events to the marker hover to reposition its shim:
marker.addListener('mouseover', function() {
accessible_gmaps.resetMarker(markerIndex, accessible_gmaps.getMapData());
});
// Bind events to the marker overlay to manipulate its marker's z index.
jQuery('div#' + markerID).focus(accessible_gmaps.zUp);
jQuery('div#' + markerID).blur(accessible_gmaps.zDown);
jQuery('div#' + markerID).focus(function(){
//accessible_gmaps.zUp
accessible_gmaps.resetMarker(markerIndex, accessible_gmaps.getMapData());
});
jQuery('div#' + markerID).blur(function(){
//accessible_gmaps.zDown
accessible_gmaps.resetMarker(markerIndex, accessible_gmaps.getMapData());
});
// If the accessible infowindows module is enabled, bind handlers to open the modal infowindow.
if(accessible_gmaps.infowindowsEnabled){
......@@ -332,13 +342,23 @@
}
/**
* Wrapper function for resetMarker
* that resets all markers in the markers array.
* Moves all marker shims off-screen.
*/
accessible_gmaps.resetAllMarkers = function(){
var mapData = accessible_gmaps.getMapData();
var bounds = accessible_gmaps.map.getBounds();
for(var i = 0; i < accessible_gmaps.markers.length; i++){
accessible_gmaps.resetMarker(i, mapData);
var marker = accessible_gmaps.markers[i];
var markerID = "mkr-" + i;
// If marker is not in bounds, hide the overlay.
if(!bounds.contains(marker.getPosition())){
jQuery('div#' + markerID).css('display', 'none');
}
// If the marker is in bounds, position the overlay off-screen. This will keep it from receiving incorrect mouse hover, until it is repositioned by its marker's hover or its own focus event.
else {
jQuery('div#' + markerID).css('left', '-2000px');
jQuery('div#' + markerID).css('top', '-2000px');
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment