make tween panning use Map::moveByPx. p=aabt, r=me (closes #3098)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11536 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-02-25 18:14:29 +00:00
parent 2d5f29c55e
commit 5826bf5f3b

View File

@@ -1606,31 +1606,25 @@ OpenLayers.Map = OpenLayers.Class({
return;
}
var from = {
lon: center.lon,
lat: center.lat
};
var to = {
lon: lonlat.lon,
lat: lonlat.lat
};
this.panTween.start(from, to, this.panDuration, {
var from = this.getPixelFromLonLat(center);
var to = this.getPixelFromLonLat(lonlat);
var vector = { x: to.x - from.x, y: to.y - from.y };
var last = { x: 0, y: 0 };
this.panTween.start( { x: 0, y: 0 }, vector, this.panDuration, {
callbacks: {
start: OpenLayers.Function.bind(function(lonlat) {
start: OpenLayers.Function.bind(function() {
this.events.triggerEvent("movestart");
}, this),
eachStep: OpenLayers.Function.bind(function(lonlat) {
lonlat = new OpenLayers.LonLat(lonlat.lon, lonlat.lat);
this.moveTo(lonlat, this.zoom, {
'dragging': true,
'noEvent': true
});
eachStep: OpenLayers.Function.bind(function(px) {
var x = px.x - last.x,
y = px.y - last.y;
this.moveByPx(x, y);
last.x = Math.round(px.x);
last.y = Math.round(px.y);
}, this),
done: OpenLayers.Function.bind(function(lonlat) {
lonlat = new OpenLayers.LonLat(lonlat.lon, lonlat.lat);
this.moveTo(lonlat, this.zoom, {
'noEvent': true
});
done: OpenLayers.Function.bind(function(px) {
this.moveTo(lonlat, this.zoom, {noEvent: true});
this.events.triggerEvent("moveend");
}, this)
}