"panTo should use tween if new center is in the current bounds + a ratio".

Add a bounds.scale method (takes a ratio and an optional center) and 
call it from the panTo to give a ratio we can pan inside of. Patch by
sbenthall, r=me,elemoine (Closes #1341) 


git-svn-id: http://svn.openlayers.org/trunk/openlayers@7678 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-08-02 01:56:36 +00:00
parent 61225ed98f
commit f1882f0efa
3 changed files with 69 additions and 1 deletions

View File

@@ -196,6 +196,13 @@ OpenLayers.Map = OpenLayers.Class({
*/
zoom: 0,
/**
* Property: panRatio
* {Float} The ratio of the current extent within
* which panning will tween.
*/
panRatio: 1.5,
/**
* Property: viewRequestID
* {String} Used to store a unique identifier that changes when the map
@@ -1368,7 +1375,7 @@ OpenLayers.Map = OpenLayers.Class({
* lonlat - {<OpenLayers.Lonlat>}
*/
panTo: function(lonlat) {
if (this.panMethod && this.getExtent().containsLonLat(lonlat)) {
if (this.panMethod && this.getExtent().scale(this.panRatio).containsLonLat(lonlat)) {
if (!this.panTween) {
this.panTween = new OpenLayers.Tween(this.panMethod);
}