diff --git a/lib/OpenLayers/Control/Navigation.js b/lib/OpenLayers/Control/Navigation.js index 17d2bf0aaa..38bc45c667 100644 --- a/lib/OpenLayers/Control/Navigation.js +++ b/lib/OpenLayers/Control/Navigation.js @@ -238,8 +238,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, { * evt - {Event} */ defaultDblClick: function (evt) { - var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); - this.map.setCenter(newCenter, this.map.zoom + 1); + this.map.zoomTo(this.map.zoom + 1, evt.xy); }, /** @@ -249,8 +248,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, { * evt - {Event} */ defaultDblRightClick: function (evt) { - var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); - this.map.setCenter(newCenter, this.map.zoom - 1); + this.map.zoomTo(this.map.zoom - 1, evt.xy); }, /** @@ -264,22 +262,14 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, { if (!this.map.fractionalZoom) { deltaZ = Math.round(deltaZ); } - var currentZoom = this.map.getZoom(); - var newZoom = this.map.getZoom() + deltaZ; + var currentZoom = this.map.getZoom(), + newZoom = currentZoom + deltaZ; newZoom = Math.max(newZoom, 0); newZoom = Math.min(newZoom, this.map.getNumZoomLevels()); if (newZoom === currentZoom) { return; } - var size = this.map.getSize(); - var deltaX = size.w/2 - evt.xy.x; - var deltaY = evt.xy.y - size.h/2; - var newRes = this.map.baseLayer.getResolutionForZoom(newZoom); - var zoomPoint = this.map.getLonLatFromPixel(evt.xy); - var newCenter = new OpenLayers.LonLat( - zoomPoint.lon + deltaX * newRes, - zoomPoint.lat + deltaY * newRes ); - this.map.setCenter( newCenter, newZoom ); + this.map.zoomTo(newZoom, evt.xy); }, /** diff --git a/lib/OpenLayers/Control/TouchNavigation.js b/lib/OpenLayers/Control/TouchNavigation.js index 7ff476eaf2..2a3b8f57be 100644 --- a/lib/OpenLayers/Control/TouchNavigation.js +++ b/lib/OpenLayers/Control/TouchNavigation.js @@ -175,8 +175,7 @@ OpenLayers.Control.TouchNavigation = OpenLayers.Class(OpenLayers.Control, { * evt - {Event} */ defaultDblClick: function (evt) { - var newCenter = this.map.getLonLatFromViewPortPx(evt.xy); - this.map.setCenter(newCenter, this.map.zoom + 1); + this.map.zoomTo(this.map.zoom + 1, evt.xy); }, CLASS_NAME: "OpenLayers.Control.TouchNavigation" diff --git a/lib/OpenLayers/Control/ZoomBox.js b/lib/OpenLayers/Control/ZoomBox.js index 58da952c9d..93f14dd736 100644 --- a/lib/OpenLayers/Control/ZoomBox.js +++ b/lib/OpenLayers/Control/ZoomBox.js @@ -69,7 +69,8 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, { */ zoomBox: function (position) { if (position instanceof OpenLayers.Bounds) { - var bounds; + var bounds, + targetCenterPx = position.getCenterPixel(); if (!this.out) { var minXY = this.map.getLonLatFromPixel({ x: position.left, @@ -87,8 +88,7 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, { var zoomFactor = Math.min((this.map.size.h / pixHeight), (this.map.size.w / pixWidth)); var extent = this.map.getExtent(); - var center = this.map.getLonLatFromPixel( - position.getCenterPixel()); + var center = this.map.getLonLatFromPixel(targetCenterPx); var xmin = center.lon - (extent.getWidth()/2)*zoomFactor; var xmax = center.lon + (extent.getWidth()/2)*zoomFactor; var ymin = center.lat - (extent.getHeight()/2)*zoomFactor; @@ -96,18 +96,27 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, { bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax); } // always zoom in/out - var lastZoom = this.map.getZoom(); - this.map.zoomToExtent(bounds); + var lastZoom = this.map.getZoom(), + size = this.map.getSize(), + centerPx = {x: size.w / 2, y: size.h / 2}, + zoom = this.map.getZoomForExtent(bounds), + oldRes = this.map.getResolution(), + newRes = this.map.getResolutionForZoom(zoom), + zoomOriginPx = { + x: targetCenterPx.x + + (targetCenterPx.x - centerPx.x) * newRes / oldRes, + y: targetCenterPx.y + + (targetCenterPx.y - centerPx.y) * newRes / oldRes + }; + this.map.zoomTo(zoom, zoomOriginPx); if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){ this.map.zoomTo(lastZoom + (this.out ? -1 : 1)); } } else if (this.zoomOnClick) { // it's a pixel if (!this.out) { - this.map.setCenter(this.map.getLonLatFromPixel(position), - this.map.getZoom() + 1); + this.map.zoomTo(this.map.getZoom() + 1, position); } else { - this.map.setCenter(this.map.getLonLatFromPixel(position), - this.map.getZoom() - 1); + this.map.zoomTo(this.map.getZoom() - 1, position); } } }, diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 07c15496ed..fa66d8803b 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -387,12 +387,6 @@ OpenLayers.Map = OpenLayers.Class({ */ autoUpdateSize: true, - /** - * Property: panTween - * {} Animated panning tween object, see panTo() - */ - panTween: null, - /** * APIProperty: eventListeners * {Object} If set as an option at construction, the eventListeners @@ -402,6 +396,12 @@ OpenLayers.Map = OpenLayers.Class({ */ eventListeners: null, + /** + * Property: panTween + * {} Animated panning tween object, see panTo() + */ + panTween: null, + /** * APIProperty: panMethod * {Function} The Easing function to be used for tweening. Default is @@ -419,6 +419,28 @@ OpenLayers.Map = OpenLayers.Class({ */ panDuration: 50, + /** + * Property: zoomTween + * {} Animated zooming tween object, see zoomTo() + */ + zoomTween: null, + + /** + * APIProperty: zoomMethod + * {Function} The Easing function to be used for tweening. Default is + * OpenLayers.Easing.Quad.easeOut. Setting this to 'null' turns off + * animated zooming. + */ + zoomMethod: OpenLayers.Easing.Quad.easeOut, + + /** + * Property: zoomDuration + * {Integer} The number of steps to be passed to the + * OpenLayers.Tween.start() method when the map is zoomed. + * Default is 20. + */ + zoomDuration: 20, + /** * Property: paddingForPopups * {} Outside margin of the popup. Used to prevent @@ -586,6 +608,7 @@ OpenLayers.Map = OpenLayers.Class({ this.layerContainerDiv = OpenLayers.Util.createDiv(id); this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE['Popup']-1; this.layerContainerOriginPx = {x: 0, y: 0}; + this.applyTransform(); this.viewPortDiv.appendChild(this.layerContainerDiv); @@ -681,6 +704,13 @@ OpenLayers.Map = OpenLayers.Class({ this.setCenter(options.center, options.zoom); } } + + if (this.panMethod) { + this.panTween = new OpenLayers.Tween(this.panMethod); + } + if (this.zoomMethod && this.applyTransform.transform) { + this.zoomTween = new OpenLayers.Tween(this.zoomMethod); + } }, /** @@ -749,6 +779,11 @@ OpenLayers.Map = OpenLayers.Class({ this.panTween.stop(); this.panTween = null; } + // make sure zooming doesn't continue after destruction + if(this.zoomTween) { + this.zoomTween.stop(); + this.zoomTween = null; + } // map has been destroyed. dont do it again! OpenLayers.Event.stopObserving(window, 'unload', this.unloadDestroy); @@ -1664,10 +1699,7 @@ OpenLayers.Map = OpenLayers.Class({ * lonlat - {} */ panTo: function(lonlat) { - if (this.panMethod && this.getExtent().scale(this.panRatio).containsLonLat(lonlat)) { - if (!this.panTween) { - this.panTween = new OpenLayers.Tween(this.panMethod); - } + if (this.panTween && this.getExtent().scale(this.panRatio).containsLonLat(lonlat)) { var center = this.getCachedCenter(); // center will not change, don't do nothing @@ -1718,7 +1750,12 @@ OpenLayers.Map = OpenLayers.Class({ * TBD: reconsider forceZoomChange in 3.0 */ setCenter: function(lonlat, zoom, dragging, forceZoomChange) { - this.panTween && this.panTween.stop(); + if (this.panTween) { + this.panTween.stop(); + } + if (this.zoomTween) { + this.zoomTween.stop(); + } this.moveTo(lonlat, zoom, { 'dragging': dragging, 'forceZoomChange': forceZoomChange @@ -2319,17 +2356,65 @@ OpenLayers.Map = OpenLayers.Class({ /** * APIMethod: zoomTo - * Zoom to a specific zoom level + * Zoom to a specific zoom level. Zooming will be animated unless the map + * is configured with {zoomMethod: null}. To zoom without animation, use + * without a lonlat argument. * * Parameters: * zoom - {Integer} */ - zoomTo: function(zoom) { - if (this.isValidZoomLevel(zoom)) { - this.setCenter(null, zoom); + zoomTo: function(zoom, xy) { + // non-API arguments: + // xy - {} optional zoom origin + + var map = this; + if (map.isValidZoomLevel(zoom)) { + if (map.baseLayer.wrapDateLine) { + zoom = map.adjustZoom(zoom); + } + if (map.zoomTween) { + var currentRes = map.getResolution(), + targetRes = map.getResolutionForZoom(zoom), + start = {scale: 1}, + end = {scale: currentRes / targetRes}; + if (map.zoomTween.playing && map.zoomTween.duration < 3 * map.zoomDuration) { + // update the end scale, and reuse the running zoomTween + map.zoomTween.finish = { + scale: map.zoomTween.finish.scale * end.scale + } + } else { + if (!xy) { + var size = map.getSize(); + xy = {x: size.w / 2, y: size.h / 2}; + } + map.zoomTween.start(start, end, map.zoomDuration, { + minFrameRate: 50, // don't spend much time zooming + callbacks: { + eachStep: function(data) { + var containerOrigin = map.layerContainerOriginPx, + scale = data.scale, + dx = ((scale - 1) * (containerOrigin.x - xy.x)) | 0, + dy = ((scale - 1) * (containerOrigin.y - xy.y)) | 0; + map.applyTransform(containerOrigin.x + dx, containerOrigin.y + dy, scale); + }, + done: function(data) { + map.applyTransform(); + var resolution = map.getResolution() / data.scale, + zoom = map.getZoomForResolution(resolution, true) + map.moveTo(map.getZoomTargetCenter(xy, resolution), zoom, true); + } + } + }); + } + } else { + var center = xy ? + map.getZoomTargetCenter(xy, map.getResolutionForZoom(zoom)) : + null; + map.setCenter(center, zoom); + } } }, - + /** * APIMethod: zoomIn * @@ -2487,7 +2572,32 @@ OpenLayers.Map = OpenLayers.Class({ return px; }, - + /** + * Method: getZoomTargetCenter + * + * Parameters: + * xy - {} The zoom origin pixel location on the screen + * resolution - {Float} The resolution we want to get the center for + * + * Returns: + * {} The location of the map center after the + * transformation described by the origin xy and the target resolution. + */ + getZoomTargetCenter: function (xy, resolution) { + var lonlat = null, + size = this.getSize(), + deltaX = size.w/2 - xy.x, + deltaY = xy.y - size.h/2, + zoomPoint = this.getLonLatFromPixel(xy); + if (zoomPoint) { + lonlat = new OpenLayers.LonLat( + zoomPoint.lon + deltaX * resolution, + zoomPoint.lat + deltaY * resolution + ); + } + return lonlat; + }, + // // CONVENIENCE TRANSLATION FUNCTIONS FOR API // diff --git a/tests/Control/Navigation.html b/tests/Control/Navigation.html index 70428f5a7b..e73ee42d14 100644 --- a/tests/Control/Navigation.html +++ b/tests/Control/Navigation.html @@ -148,6 +148,7 @@ var nav = new OpenLayers.Control.Navigation({zoomWheelEnabled: false}); var map = new OpenLayers.Map({ div: "map", + zoomMethod: null, controls: [nav], layers: [ new OpenLayers.Layer(null, {isBaseLayer: true}) diff --git a/tests/Control/NavigationHistory.html b/tests/Control/NavigationHistory.html index b766b0e5ae..c992ff2b7a 100644 --- a/tests/Control/NavigationHistory.html +++ b/tests/Control/NavigationHistory.html @@ -170,7 +170,7 @@ function test_clear(t) { t.plan(7); - var map = new OpenLayers.Map("map"); + var map = new OpenLayers.Map("map", {zoomMethod: null}); var layer = new OpenLayers.Layer( "test", {isBaseLayer: true} ); diff --git a/tests/Control/PanZoomBar.html b/tests/Control/PanZoomBar.html index b14ec2adba..28327768f5 100644 --- a/tests/Control/PanZoomBar.html +++ b/tests/Control/PanZoomBar.html @@ -77,7 +77,7 @@ function test_Control_PanZoomBar_onButtonClick (t) { t.plan(2); - map = new OpenLayers.Map('map', {controls:[]}); + map = new OpenLayers.Map('map', {controls:[], zoomMethod: null}); var layer = new OpenLayers.Layer.WMS("Test Layer", "http://octo.metacarta.com/cgi-bin/mapserv?", {map: "/mapdata/vmap_wms.map", layers: "basic"}); @@ -97,7 +97,8 @@ t.plan(1); map = new OpenLayers.Map('map', { controls: [], - fractionalZoom: true + fractionalZoom: true, + zoomMethod: null }); var layer = new OpenLayers.Layer.WMS("Test Layer", "http://octo.metacarta.com/cgi-bin/mapserv?", { map: "/mapdata/vmap_wms.map", @@ -127,7 +128,8 @@ var map = new OpenLayers.Map('map', { controls: [], - fractionalZoom: true + fractionalZoom: true, + zoomMethod: null, }); var layer = new OpenLayers.Layer.WMS("Test Layer", "http://octo.metacarta.com/cgi-bin/mapserv?", { map: "/mapdata/vmap_wms.map", diff --git a/tests/Control/Scale.html b/tests/Control/Scale.html index 804ceb5622..1d43b25e08 100644 --- a/tests/Control/Scale.html +++ b/tests/Control/Scale.html @@ -22,7 +22,7 @@ control = new OpenLayers.Control.Scale('scale'); t.ok( control instanceof OpenLayers.Control.Scale, "new OpenLayers.Control returns object" ); - map = new OpenLayers.Map('map'); + map = new OpenLayers.Map('map', {zoomMethod: null}); layer = new OpenLayers.Layer.WMS('Test Layer', "http://octo.metacarta.com/cgi-bin/mapserv", {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}); map.addLayer(layer); map.zoomTo(0); @@ -38,7 +38,7 @@ t.plan(2); control = new OpenLayers.Control.Scale(); t.ok( control instanceof OpenLayers.Control.Scale, "new OpenLayers.Control returns object" ); - map = new OpenLayers.Map('map'); + map = new OpenLayers.Map('map', {zoomMethod: null}); layer = new OpenLayers.Layer.WMS('Test Layer', "http://octo.metacarta.com/cgi-bin/mapserv", {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}); map.addLayer(layer); map.zoomTo(0); diff --git a/tests/Control/Zoom.html b/tests/Control/Zoom.html index c27161dab8..cfeb082cc4 100644 --- a/tests/Control/Zoom.html +++ b/tests/Control/Zoom.html @@ -43,7 +43,8 @@ var map = new OpenLayers.Map({ div: "map", - layers: [new OpenLayers.Layer(null, {isBaseLayer: true})] + layers: [new OpenLayers.Layer(null, {isBaseLayer: true})], + zoomMethod: null }); var control = new OpenLayers.Control.Zoom(); map.addControl(control); @@ -60,7 +61,8 @@ var map = new OpenLayers.Map({ div: "map", - layers: [new OpenLayers.Layer(null, {isBaseLayer: true})] + layers: [new OpenLayers.Layer(null, {isBaseLayer: true})], + zoomMethod: null }); var control = new OpenLayers.Control.Zoom(); map.addControl(control); diff --git a/tests/Layer/Grid.html b/tests/Layer/Grid.html index dc607d1ead..dd8a834b88 100644 --- a/tests/Layer/Grid.html +++ b/tests/Layer/Grid.html @@ -672,7 +672,7 @@ } function test_Layer_Grid_getTileBounds(t) { t.plan(2); - var map = new OpenLayers.Map("map2"); + var map = new OpenLayers.Map("map2", {zoomMethod: null}); var url = "http://octo.metacarta.com/cgi-bin/mapserv"; layer = new OpenLayers.Layer.WMS(name, url, params); @@ -869,7 +869,8 @@ t.plan(11); var map = new OpenLayers.Map('map', { - resolutions: [32, 16, 8, 4, 2, 1] + resolutions: [32, 16, 8, 4, 2, 1], + zoomMethod: null }); var layer = new OpenLayers.Layer.WMS('', '', {}, { isBaseLayer: true, @@ -930,7 +931,8 @@ t.plan(4); var map = new OpenLayers.Map('map', { - resolutions: [1, 0.5, 0.025] + resolutions: [1, 0.5, 0.025], + zoomMethod: null }); var resolution; var layer = new OpenLayers.Layer.WMS('', '', {}, { @@ -974,7 +976,8 @@ t.plan(4); var map = new OpenLayers.Map('map', { - resolutions: [1, 0.5, 0.025] + resolutions: [1, 0.5, 0.025], + zoomMethod: null }); var resolution; var layer = new OpenLayers.Layer.WMS('', '', {}, { @@ -1156,7 +1159,7 @@ t.plan(4); - var map = new OpenLayers.Map('map'); + var map = new OpenLayers.Map('map', {zoomMethod: null}); var layer = new OpenLayers.Layer.WMS('', '', {}, { isBaseLayer: true, singleTile: true, @@ -1187,7 +1190,8 @@ // var map = new OpenLayers.Map('map', { - resolutions: [32, 16, 8, 4, 2, 1] + resolutions: [32, 16, 8, 4, 2, 1], + zoomMethod: null }); var layer = new OpenLayers.Layer.WMS( "WMS", diff --git a/tests/Layer/KaMap.html b/tests/Layer/KaMap.html index c6b5ba773c..a41e4ebd0b 100644 --- a/tests/Layer/KaMap.html +++ b/tests/Layer/KaMap.html @@ -233,7 +233,7 @@ } function test_Layer_KaMap_getTileBounds(t) { t.plan(2); - var map = new OpenLayers.Map("map"); + var map = new OpenLayers.Map("map", {zoomMethod: null}); var url = "http://octo.metacarta.com/cgi-bin/mapserv"; layer = new OpenLayers.Layer.KaMap(name, url, params); diff --git a/tests/Layer/Markers.html b/tests/Layer/Markers.html index 2db3052e60..07f699fedc 100644 --- a/tests/Layer/Markers.html +++ b/tests/Layer/Markers.html @@ -59,7 +59,7 @@ t.plan(6); - var map = new OpenLayers.Map("map"); + var map = new OpenLayers.Map("map", {zoomMethod: null}); var layer = new OpenLayers.Layer.Markers("Base", {isBaseLayer: true}); map.addLayer(layer); map.setCenter(new OpenLayers.LonLat(0, 0), 1); diff --git a/tests/Layer/PointGrid.html b/tests/Layer/PointGrid.html index 22d85c7dea..6fb6ae2012 100644 --- a/tests/Layer/PointGrid.html +++ b/tests/Layer/PointGrid.html @@ -211,7 +211,8 @@ div: "map", layers: [layer], center: new OpenLayers.LonLat(0, 0), - zoom: 1 + zoom: 1, + zoomMethod: null }); t.eq(layer.features.length, 50, "50 features at zoom 1"); diff --git a/tests/Layer/WMTS.html b/tests/Layer/WMTS.html index e8d7a235f1..c6dcd4cfc0 100644 --- a/tests/Layer/WMTS.html +++ b/tests/Layer/WMTS.html @@ -245,7 +245,8 @@ layers: [layer], projection: "EPSG:4326", maxResolution: 0.3515625, - maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90) + maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90), + zoomMethod: null }); map.setCenter(new OpenLayers.LonLat(-97.0, 38.0), 1); t.eq(layer.getURL(new OpenLayers.Bounds(-135.0, 0.0, -90.0, 45.0)), diff --git a/tests/Map.html b/tests/Map.html index fb05de0ffd..4b1475a75d 100644 --- a/tests/Map.html +++ b/tests/Map.html @@ -216,6 +216,7 @@ t.plan(14); var log = []; map = new OpenLayers.Map('map', { + zoomMethod: null, eventListeners: { "movestart": function() {log.push("movestart");}, "move": function() {log.push("move");}, @@ -268,7 +269,7 @@ function test_Map_zoomend_event (t) { t.plan(2); - map = new OpenLayers.Map('map'); + map = new OpenLayers.Map('map', {zoomMethod: null}); var baseLayer = new OpenLayers.Layer.WMS("Test Layer", "http://octo.metacarta.com/cgi-bin/mapserv?", {map: "/mapdata/vmap_wms.map", layers: "basic"}); @@ -1292,7 +1293,8 @@ extent = new OpenLayers.Bounds(8, 44.5, 19, 50); var options = { - restrictedExtent: extent + restrictedExtent: extent, + zoomMethod: null }; map = new OpenLayers.Map('map', options); @@ -1330,7 +1332,7 @@ function test_zoomTo(t) { t.plan(8); - var map = new OpenLayers.Map("map"); + var map = new OpenLayers.Map("map", {zoomMethod: null}); map.addLayer(new OpenLayers.Layer(null, { isBaseLayer: true })); @@ -1367,6 +1369,38 @@ map.destroy(); } + function test_zoomTo_animated(t) { + t.plan(2); + + var map = new OpenLayers.Map("map"); + map.addLayer(new OpenLayers.Layer(null, { + isBaseLayer: true + })); + + map.zoomToMaxExtent(); + + map.zoomTo(2); + map.zoomIn(); + map.zoomOut(); + map.zoomIn(); + t.delay_call(2, function() { + t.eq(map.getZoom(), 3, '[fractionalZoom: false] zoomTo(2) - zoomIn() - zoomOut() - zoomIn()'); + + // now allow fractional zoom + map.fractionalZoom = true; + + map.zoomTo(2.6); + map.zoomIn(); + map.zoomOut(); + map.zoomIn(); + }); + t.delay_call(4, function() { + t.eq(map.getZoom(), 3.6, '[fractionalZoom: true] zoomTo(2) - zoomIn() - zoomOut() - zoomIn()'); + map.destroy(); + }); + + } + function test_Map_getUnits(t) { t.plan(2); var map = new OpenLayers.Map("map"); @@ -2166,6 +2200,24 @@ var center = map.getCenter(); t.ok(center.equals(new OpenLayers.LonLat(-13.25, 56)), "Center is correct and not equal to maxExtent's center"); } + + function test_getZoomTargetCenter(t) { + t.plan(1); + var map = new OpenLayers.Map({ + div: 'map', + layers: [ + new OpenLayers.Layer('', {isBaseLayer: true}) + ], + center: [0, 0], + zoom: 1 + }); + + var ll = map.getZoomTargetCenter({x: 44, y: 22}, map.getMaxResolution()); + + t.eq(ll.toShortString(), "180, -90", "getZoomTargetCenter works."); + + map.destroy(); + } function test_autoUpdateSize(t) { t.plan(1); diff --git a/tests/Strategy/BBOX.html b/tests/Strategy/BBOX.html index d45e8df068..6e409e6daf 100644 --- a/tests/Strategy/BBOX.html +++ b/tests/Strategy/BBOX.html @@ -51,7 +51,7 @@ }); // create a map with the layers and a center - var map = new OpenLayers.Map("map"); + var map = new OpenLayers.Map("map", {zoomMethod: null}); map.addLayers([dummy, layer]); map.zoomToMaxExtent(); @@ -206,7 +206,7 @@ function test_resFactor(t) { t.plan(2); - var map = new OpenLayers.Map("map"); + var map = new OpenLayers.Map("map", {zoomMethod: null}); var bbox = new OpenLayers.Strategy.BBOX(); var fakeProtocol = new OpenLayers.Protocol({ 'read': function() { diff --git a/tests/Strategy/Cluster.html b/tests/Strategy/Cluster.html index 05130bbfb7..d5f7a9b285 100644 --- a/tests/Strategy/Cluster.html +++ b/tests/Strategy/Cluster.html @@ -44,7 +44,8 @@ }); var map = new OpenLayers.Map('map', { resolutions: [4, 2, 1], - maxExtent: new OpenLayers.Bounds(-40, -40, 40, 40) + maxExtent: new OpenLayers.Bounds(-40, -40, 40, 40), + zoomMethod: null, }); map.addLayer(layer);