From b72ada312a4ab377035fb09b06419af3ebb84663 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 24 Apr 2013 17:04:27 -0300 Subject: Adds setCenter() and updateCenter() --- gmap_arcgis.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'gmap_arcgis.js') 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); + }, } }; -- cgit v1.2.3