"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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user