aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@socioambiental.org>2013-07-23 17:56:02 -0300
committerSilvio <silvio@socioambiental.org>2013-07-23 17:56:02 -0300
commit256b7f489e24ba84b66638ba048b1b4fa4aeea33 (patch)
treeb304471c0252fec7f9faaf072058c9c7b0a6fd04
parent4e787be78c8bcbaaed25b277bd270ce9d75d88b0 (diff)
downloadgmap_arcgis_js-256b7f489e24ba84b66638ba048b1b4fa4aeea33.tar.gz
gmap_arcgis_js-256b7f489e24ba84b66638ba048b1b4fa4aeea33.tar.bz2
Joining the two fitBounds implementations at showPolygonFromQuery()
-rw-r--r--gmap_arcgis.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/gmap_arcgis.js b/gmap_arcgis.js
index 7d87820..018e470 100644
--- a/gmap_arcgis.js
+++ b/gmap_arcgis.js
@@ -536,6 +536,7 @@ function gmapArcgis(config) {
// Show a polygon resulting from the given query
showPolygonFromQuery: function(params) {
var self = this;
+ var limit = null;
var layer = new gmaps.ags.Layer(params.uri);
var query = {
returnGeometry: true,
@@ -546,7 +547,6 @@ function gmapArcgis(config) {
};
layer.query(query, function(fset) {
- var limit;
var fs = fset.features;
params.overlay = [];
@@ -558,14 +558,8 @@ function gmapArcgis(config) {
if (params.fitBounds != undefined && params.fitBounds == true) {
var bounds = params.overlay[i].getBounds();
- // 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
- if (limit.union == undefined) {
+ // Join bounds together
+ if (limit === null) {
limit = bounds;
}
else {
@@ -583,8 +577,13 @@ function gmapArcgis(config) {
});
}
- // Fit map to bounds, new version
- self.map.fitBounds(limit);
+ // Fit map to limits
+ if (params.fitBounds != undefined && params.fitBounds == true) {
+ var zoom = self.getZoomByBounds(limit);
+ var center = limit.getCenter();
+ self.map.setZoom(zoom);
+ self.setCenter(center, true);
+ }
return params.overlay;
});