Guest User

Untitled

a guest
Jul 19th, 2018
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. function addRoutesToMap() {
  2. var directions = [];
  3. $.each(routes, function(i, route) {
  4. directions[i] = new GDirections(map);
  5. directions[i].loadFromWaypoints([new GLatLng(route[0][0], route[0][1]), new GLatLng(route[1][0], route[1][1])], {preserveViewport: true});
  6. // View port is preserved so it doesn't try to zoom to wrap every single bloody route.
  7.  
  8. GEvent.addListener(directions[i], 'addoverlay', function() {
  9. directions[i].getMarker(1).hide();
  10. directions[i].getMarker(0).hide();
  11. });
  12. // if (i == (routes.length - 1)) { // No longer necessary. See {preserveViewport: true} above
  13. // GEvent.addListener(directions[i], 'addoverlay', function() {
  14. // map.setCenter(region_center, Number($('#region_zoom')[0].value)); //Typecasting? WTF mate?
  15. // });
  16. // }
  17. });
  18. }
Add Comment
Please, Sign In to add comment