Changeset 6045
- Timestamp:
- 02/07/08 16:59:03 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/crschmidt/animated_panning/lib/OpenLayers/Control/OverviewMap.js
r6010 r6045 435 435 // create the overview map 436 436 var options = OpenLayers.Util.extend( 437 {controls: [], maxResolution: 'auto' }, this.mapOptions);437 {controls: [], maxResolution: 'auto', 'fallThrough': false}, this.mapOptions); 438 438 this.ovmap = new OpenLayers.Map(this.mapDiv, options); 439 439 … … 511 511 updateMapToRect: function() { 512 512 var lonLatBounds = this.getMapBoundsFromRectBounds(this.rectPxBounds); 513 this.map. setCenter(lonLatBounds.getCenterLonLat(), this.map.zoom);513 this.map.panTo(lonLatBounds.getCenterLonLat()); 514 514 }, 515 515 sandbox/crschmidt/animated_panning/lib/OpenLayers/Map.js
r6035 r6045 1242 1242 if (!newCenterPx.equals(centerPx)) { 1243 1243 var newCenterLonLat = this.getLonLatFromViewPortPx(newCenterPx); 1244 this. setCenter(newCenterLonLat);1244 this.panTo(newCenterLonLat); 1245 1245 } 1246 1246 1247 1247 }, 1248 1249 /** 1250 * APIMethod: panTo 1251 * Allows user to pan to a new lonlat 1252 * If the new lonlat is in the current extent the map will slide smoothly 1253 * 1254 * Parameters: 1255 * lonlat - {<OpenLayers.Lonlat>} 1256 */ 1257 panTo: function(lonlat) { 1258 if (this.getExtent().containsLonLat(lonlat)) { 1259 if (!this.panTween) { 1260 this.panTween = new OpenLayers.Tween(OpenLayers.Easing.Expo.easeOut); 1261 } 1262 var center = this.getCenter(); 1263 var from = { 1264 lon: center.lon, 1265 lat: center.lat 1266 }; 1267 var to = { 1268 lon: lonlat.lon, 1269 lat: lonlat.lat 1270 }; 1271 this.panTween.start(from, to, 50, { 1272 callbacks: { 1273 start: OpenLayers.Function.bind(function(lonlat) { 1274 this.events.triggerEvent("movestart"); 1275 }, this), 1276 eachStep: OpenLayers.Function.bind(function(lonlat) { 1277 var lonlat = new OpenLayers.LonLat(lonlat.lon, lonlat.lat); 1278 this.moveTo(lonlat, this.zoom, true); 1279 }, this), 1280 done: OpenLayers.Function.bind(function(lonlat) { 1281 this.events.triggerEvent("moveend"); 1282 }, this) 1283 } 1284 }); 1285 } else { 1286 this.setCenter(lonlat); 1287 } 1288 }, 1248 1289 1249 1290 /** … … 1286 1327 // noEvent is false by default 1287 1328 var noEvent = options.noEvent; 1329 1330 if (this.panTween && options.source == "setCenter") { 1331 this.panTween.stop(); 1332 } 1288 1333 1289 1334 if (!this.center && !this.isValidLonLat(lonlat)) {
