diff options
author | Silvio <silvio@socioambiental.org> | 2013-04-24 17:04:27 -0300 |
---|---|---|
committer | Silvio <silvio@socioambiental.org> | 2013-04-24 17:04:27 -0300 |
commit | b72ada312a4ab377035fb09b06419af3ebb84663 (patch) | |
tree | c6495971e49158388a7a9ee3ffeb0777efb54e61 | |
parent | 81d9b95216bc1f83b84eabd3537532a66841aaa3 (diff) | |
download | gmap_arcgis_js-b72ada312a4ab377035fb09b06419af3ebb84663.tar.gz gmap_arcgis_js-b72ada312a4ab377035fb09b06419af3ebb84663.tar.bz2 |
Adds setCenter() and updateCenter()
-rw-r--r-- | gmap_arcgis.js | 17 |
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); + }, } }; |