aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
+ },
}
};