aboutsummaryrefslogtreecommitdiff
path: root/gmap_arcgis.js
diff options
context:
space:
mode:
Diffstat (limited to 'gmap_arcgis.js')
-rw-r--r--gmap_arcgis.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 7fe4fca..70adb19 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -527,6 +527,7 @@ function gmapArcgis(config) {
layer.query(query, function(fset) {
var fs = fset.features;
+ var limit = new google.maps.LatLngBounds();
params.overlay = [];
for (i in fs) {
@@ -536,11 +537,15 @@ function gmapArcgis(config) {
// Fit map to polygon bounds
if (params.fitBounds != undefined && params.fitBounds == true) {
var bounds = params.overlay[i].getBounds();
- var zoom = self.getZoomByBounds(bounds);
- var center = bounds.getCenter();
- self.map.setZoom(zoom);
- self.setCenter(center, true);
+ // Fit map to bounds, old version
+ //var zoom = self.getZoomByBounds(bounds);
+ //var center = bounds.getCenter();
+ //self.map.setZoom(zoom);
+ //self.setCenter(center, true);
+
+ // Fit map to bounds, new version
+ limit.union(bounds);
}
// Show polygon
@@ -553,6 +558,9 @@ function gmapArcgis(config) {
});
}
+ // Fit map to bounds, new version
+ self.map.fitBounds(limit);
+
return params.overlay;
});
},