Commit 46998fbb10373ffd02b3d9baf9f1b8fa4955e059

Authored by Aurélio A. Heckert
Committed by Larissa Reis
1 parent de7aba86

Remove default Brazil reference from google_maps.js

The mapLoad method is also more configurable now.

Signed-off-by: Larissa Reis <larissa@colivre.coop.br>
Showing 1 changed file with 5 additions and 6 deletions   Show diff stats
public/javascripts/google_maps.js
@@ -36,12 +36,12 @@ function mapPutMarker(lat, lng, title, icon, url_or_function) { @@ -36,12 +36,12 @@ function mapPutMarker(lat, lng, title, icon, url_or_function) {
36 return marker; 36 return marker;
37 } 37 }
38 38
39 -function mapLoad(initial_zoom) {  
40 - //center in Brazil  
41 - centerPoint = new google.maps.LatLng(-15.0, -50.1419); 39 +function mapLoad(initialZoom, centerPoint) {
  40 + if (!initialZoom) initialZoom = 4;
  41 + if (!centerPoint) centerPoint = new google.maps.LatLng(0, 0);
42 42
43 map = new google.maps.Map(document.getElementById("map"), { 43 map = new google.maps.Map(document.getElementById("map"), {
44 - zoom: initial_zoom, 44 + zoom: initialZoom,
45 center: centerPoint, 45 center: centerPoint,
46 mapTypeId: google.maps.MapTypeId.ROADMAP 46 mapTypeId: google.maps.MapTypeId.ROADMAP
47 }); 47 });
@@ -55,7 +55,6 @@ function mapLoad(initial_zoom) { @@ -55,7 +55,6 @@ function mapLoad(initial_zoom) {
55 } 55 }
56 56
57 function mapCenter(latlng) { 57 function mapCenter(latlng) {
58 - if (!latlng)  
59 - map.fitBounds(mapBounds); 58 + if (!latlng) map.fitBounds(mapBounds);
60 map.setCenter(latlng ? latlng : mapBounds.getCenter()); 59 map.setCenter(latlng ? latlng : mapBounds.getCenter());
61 } 60 }