Skip to content
Snippets Groups Projects
Commit 2998621b authored by Elijah Byrd's avatar Elijah Byrd
Browse files

Bit of code cleanup.

parent 2d88a24e
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -366,23 +366,9 @@ function accessible_gmaps_addMarker(marker){
accessible_gmaps_markers.push(marker);
}
function accessible_gmaps_getMapData(){
mapData = {};
mapData.scale = Math.pow(2, accessibilityMap.getZoom());
mapData.nw = new google.maps.LatLng(
accessibilityMap.getBounds().getNorthEast().lat(),
accessibilityMap.getBounds().getSouthWest().lng()
);
mapData.projection = accessibilityMap.getProjection();
mapData.worldCoordinateNW = mapData.projection.fromLatLngToPoint(mapData.nw);
return mapData;
}
/**
* Helper function to calculate the position of a marker overlay.
* Written by Keith and almost entirely unmodified.
* Written by Keith and modified for performance.
*/
function accessible_gmaps_getMarkerPos(marker, mapData) {
var gmap = marker.map;
......@@ -395,4 +381,22 @@ function accessible_gmaps_getMarkerPos(marker, mapData) {
);
return pixelOffset;
}
/**
* Helper function to pull projection information from map.
* This info is needed in accessible_gmaps_getMarkerPos(),
* but can be calculated once for every batch of marker resets.
*/
function accessible_gmaps_getMapData(){
mapData = {};
mapData.scale = Math.pow(2, accessibilityMap.getZoom());
mapData.nw = new google.maps.LatLng(
accessibilityMap.getBounds().getNorthEast().lat(),
accessibilityMap.getBounds().getSouthWest().lng()
);
mapData.projection = accessibilityMap.getProjection();
mapData.worldCoordinateNW = mapData.projection.fromLatLngToPoint(mapData.nw);
return mapData;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment