[OpenLayers-Commits] r11608 - in trunk/openlayers: lib/OpenLayers
tests
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed Mar 2 06:09:28 EST 2011
Author: ahocevar
Date: 2011-03-02 03:09:24 -0800 (Wed, 02 Mar 2011)
New Revision: 11608
Modified:
trunk/openlayers/lib/OpenLayers/Map.js
trunk/openlayers/tests/Map.html
Log:
make setOptions work for restrictedExtent change, like it was before #3062. r=bartvde (closes #3144)
Modified: trunk/openlayers/lib/OpenLayers/Map.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Map.js 2011-03-02 09:55:28 UTC (rev 11607)
+++ trunk/openlayers/lib/OpenLayers/Map.js 2011-03-02 11:09:24 UTC (rev 11608)
@@ -739,7 +739,13 @@
* options - {Object} Hashtable of options to tag to the map
*/
setOptions: function(options) {
+ var updatePxExtent = this.minPx &&
+ options.restrictedExtent != this.restrictedExtent;
OpenLayers.Util.extend(this, options);
+ // force recalculation of minPx and maxPx
+ updatePxExtent && this.moveTo(this.getCachedCenter(), this.zoom, {
+ forceZoomChange: true
+ });
},
/**
Modified: trunk/openlayers/tests/Map.html
===================================================================
--- trunk/openlayers/tests/Map.html 2011-03-02 09:55:28 UTC (rev 11607)
+++ trunk/openlayers/tests/Map.html 2011-03-02 11:09:24 UTC (rev 11608)
@@ -1052,7 +1052,7 @@
}
function test_Map_restrictedExtent(t) {
- t.plan(24);
+ t.plan(25);
var extent = new OpenLayers.Bounds(-180, -90, 180, 90);
var options = {
maxResolution: "auto"
@@ -1147,8 +1147,28 @@
"map extent not restricted with null restrictedExtent for se");
map.destroy();
+
+ extent = new OpenLayers.Bounds(8, 44.5, 19, 50);
+ var options = {
+ restrictedExtent: extent
+ };
+ map = new OpenLayers.Map('map', options);
+
+ var wms = new OpenLayers.Layer.WMS(
+ "OpenLayers WMS",
+ "http://vmap0.tiles.osgeo.org/wms/vmap0?",
+ {layers: 'basic'}
+ );
+
+ map.addLayers([wms]);
+ map.zoomToExtent(extent);
+ map.zoomIn();
+ map.setOptions({restrictedExtent: null});
+ map.pan(-250, -250);
+ t.ok((map.getExtent().bottom == 48.3486328125 && map.getExtent().left == 7.45751953125), "Expected extent when toggling restrictedExtent");
+ map.destroy();
}
-
+
function test_Map_getResolutionForZoom(t) {
t.plan(2);
var map = new OpenLayers.Map("map");
More information about the Commits
mailing list