aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-04-24 17:04:27 -0300
committerSilvio <silvio@socioambiental.org>2013-04-24 17:04:27 -0300
commitb72ada312a4ab377035fb09b06419af3ebb84663 (patch)
treec6495971e49158388a7a9ee3ffeb0777efb54e61
parent81d9b95216bc1f83b84eabd3537532a66841aaa3 (diff)
downloadgmap_arcgis_js-b72ada312a4ab377035fb09b06419af3ebb84663.tar.gz
gmap_arcgis_js-b72ada312a4ab377035fb09b06419af3ebb84663.tar.bz2
Adds setCenter() and updateCenter()
-rw-r--r--gmap_arcgis.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index dcba39e..07b573b 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -43,6 +43,7 @@ function gmapArcgis(config) {
// Set the current map
setMap: function(map) {
this.map = map;
+ this.setCenter(map.getCenter());
},
// Get the default opacity of an layer element
@@ -489,7 +490,7 @@ function gmapArcgis(config) {
var center = bounds.getCenter();
self.map.setZoom(zoom);
- self.map.setCenter(center);
+ self.setCenter(center, true);
}
// Show polygon
@@ -565,5 +566,19 @@ function gmapArcgis(config) {
});
}
},
+
+ // Set the current map center, optionally updating the map
+ setCenter: function(latLng, update) {
+ this.config.mapCenter = latLng;
+
+ if (update != undefined && update == true) {
+ this.updateCenter();
+ }
+ },
+
+ // Update map center
+ updateCenter: function() {
+ this.map.setCenter(this.config.mapCenter);
+ },
}
};