panmethod option on map to allow for the turning off of animated panning.

Includes example. All tests pass. r=tschaub. (Closes #1356)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@6411 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-02-29 06:03:12 +00:00
parent 6ff86dc756
commit 5f93cc2b52
2 changed files with 29 additions and 4 deletions

View File

@@ -325,6 +325,14 @@ OpenLayers.Map = OpenLayers.Class({
*/
panTween: null,
/**
* Property: panMethod
* {Function} The Easing function to be used for tweening. Default is
* OpenLayers.Easing.Expo.easeOut. Setting this to 'null' turns off
* animated panning.
*/
panMethod: OpenLayers.Easing.Expo.easeOut,
/**
* Constructor: OpenLayers.Map
* Constructor for a new OpenLayers.Map instance.
@@ -1317,9 +1325,9 @@ OpenLayers.Map = OpenLayers.Class({
* lonlat - {<OpenLayers.Lonlat>}
*/
panTo: function(lonlat) {
if (this.getExtent().containsLonLat(lonlat)) {
if (this.panMethod && this.getExtent().containsLonLat(lonlat)) {
if (!this.panTween) {
this.panTween = new OpenLayers.Tween(OpenLayers.Easing.Expo.easeOut);
this.panTween = new OpenLayers.Tween(this.panMethod);
}
var center = this.getCenter();
var from = {