[Mapbender-commits] r3987 - branches/google_dev/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jun 3 05:04:02 EDT 2009


Author: christoph
Date: 2009-06-03 05:04:02 -0400 (Wed, 03 Jun 2009)
New Revision: 3987

Modified:
   branches/google_dev/http/javascripts/map_obj.js
Log:


Modified: branches/google_dev/http/javascripts/map_obj.js
===================================================================
--- branches/google_dev/http/javascripts/map_obj.js	2009-06-03 08:45:44 UTC (rev 3986)
+++ branches/google_dev/http/javascripts/map_obj.js	2009-06-03 09:04:02 UTC (rev 3987)
@@ -134,15 +134,30 @@
 	 */
 	this.calculateExtent = function(ext){
 		if (typeof this.google !== "undefined") {
-			// get extent and fit Google map
-			var sw = new google.maps.LatLng(ext.min.y, ext.min.x);
-			var ne = new google.maps.LatLng(ext.maxy, ext.max.x);
-			var latLngBounds = new google.maps.LatLngBounds(sw, ne);
-			this.google.map.fitBounds(latLngBounds);
 
+			if (this.google.map.get_zoom() < MAX_ZOOM_LEVEL) {
+				// get extent and fit Google map
+				var sw = new google.maps.LatLng(ext.min.y, ext.min.x);
+				var ne = new google.maps.LatLng(ext.maxy, ext.max.x);
+				var latLngBounds = new google.maps.LatLngBounds(sw, ne);
+				this.google.map.fitBounds(latLngBounds);
+			}
+			else {
+				var latLng = new google.maps.LatLng(ext.center.y, ext.center.x);
+				this.google.map.set_center(latLng);
+			}
+
 			var zoomByRectangleListener = google.maps.event.addListener(this.google.map, "bounds_changed", function () {
 				google.maps.event.removeListener(zoomByRectangleListener);
 
+				// check zoom level
+				if (that.google.map.get_zoom() < MIN_ZOOM_LEVEL) {
+					that.google.map.set_zoom(MIN_ZOOM_LEVEL);
+				}
+				else if (that.google.map.get_zoom() > MAX_ZOOM_LEVEL) {
+					that.google.map.set_zoom(MAX_ZOOM_LEVEL);
+				}
+
 				var newBounds = that.google.map.get_bounds();
 				var newSw = newBounds.getSouthWest();
 				var newNe = newBounds.getNorthEast();



More information about the Mapbender_commits mailing list