Changeset 6035
- Timestamp:
- 02/07/08 16:42:11 (10 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/crschmidt/animated_panning/lib/OpenLayers/Map.js
r5982 r6035 1260 1260 * TBD: reconsider forceZoomChange in 3.0 1261 1261 */ 1262 setCenter: function (lonlat, zoom, dragging, forceZoomChange) { 1263 this.dragging = !!dragging; 1264 1262 setCenter: function(lonlat, zoom, dragging, forceZoomChange) { 1263 this.moveTo(lonlat, zoom, { 1264 'dragging': dragging, 1265 'forceZoomChange': forceZoomChange, 1266 'source': 'setCenter' 1267 }); 1268 }, 1269 1270 /** 1271 * Method: moveTo 1272 * 1273 * Parameters: 1274 * lonlat - {<OpenLayers.LonLat>} 1275 * zoom - {Integer} 1276 * options - {Object} 1277 */ 1278 moveTo: function(lonlat, zoom, options) { 1279 if (!options) { 1280 options = {}; 1281 } 1282 // dragging is false by default 1283 var dragging = options.dragging; 1284 // forceZoomChange is false by default 1285 var forceZoomChange = options.forceZoomChange; 1286 // noEvent is false by default 1287 var noEvent = options.noEvent; 1288 1265 1289 if (!this.center && !this.isValidLonLat(lonlat)) { 1266 1290 lonlat = this.maxExtent.getCenterLonLat(); … … 1312 1336 if (zoomChanged || centerChanged || !dragging) { 1313 1337 1314 if (!dragging) { this.events.triggerEvent("movestart"); } 1338 if (!dragging && !noEvent) { 1339 this.events.triggerEvent("movestart"); 1340 } 1315 1341 1316 1342 if (centerChanged) { … … 1378 1404 1379 1405 // even if nothing was done, we want to notify of this 1380 if (!dragging) { this.events.triggerEvent("moveend"); } 1406 if (!dragging && !noEvent) { 1407 this.events.triggerEvent("moveend"); 1408 } 1381 1409 }, 1382 1410 sandbox/crschmidt/animated_panning/tests/test_Map.html
r5982 r6035 727 727 } 728 728 729 function test_15_Map_ setCenter(t) {729 function test_15_Map_moveTo(t) { 730 730 t.plan(1); 731 731 … … 737 737 map.addLayer(baseLayer); 738 738 var ll = new OpenLayers.LonLat(-100,-150); 739 map. setCenter(ll, 0);739 map.moveTo(ll, 0); 740 740 t.ok(map.getCenter().equals(new OpenLayers.LonLat(0,0)), "safely sets out-of-bounds lonlat"); 741 741 }
