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:
+15
-21
@@ -1606,31 +1606,25 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var from = {
|
var from = this.getPixelFromLonLat(center);
|
||||||
lon: center.lon,
|
var to = this.getPixelFromLonLat(lonlat);
|
||||||
lat: center.lat
|
var vector = { x: to.x - from.x, y: to.y - from.y };
|
||||||
};
|
var last = { x: 0, y: 0 };
|
||||||
var to = {
|
|
||||||
lon: lonlat.lon,
|
this.panTween.start( { x: 0, y: 0 }, vector, this.panDuration, {
|
||||||
lat: lonlat.lat
|
|
||||||
};
|
|
||||||
this.panTween.start(from, to, this.panDuration, {
|
|
||||||
callbacks: {
|
callbacks: {
|
||||||
start: OpenLayers.Function.bind(function(lonlat) {
|
start: OpenLayers.Function.bind(function() {
|
||||||
this.events.triggerEvent("movestart");
|
this.events.triggerEvent("movestart");
|
||||||
}, this),
|
}, this),
|
||||||
eachStep: OpenLayers.Function.bind(function(lonlat) {
|
eachStep: OpenLayers.Function.bind(function(px) {
|
||||||
lonlat = new OpenLayers.LonLat(lonlat.lon, lonlat.lat);
|
var x = px.x - last.x,
|
||||||
this.moveTo(lonlat, this.zoom, {
|
y = px.y - last.y;
|
||||||
'dragging': true,
|
this.moveByPx(x, y);
|
||||||
'noEvent': true
|
last.x = Math.round(px.x);
|
||||||
});
|
last.y = Math.round(px.y);
|
||||||
}, this),
|
}, this),
|
||||||
done: OpenLayers.Function.bind(function(lonlat) {
|
done: OpenLayers.Function.bind(function(px) {
|
||||||
lonlat = new OpenLayers.LonLat(lonlat.lon, lonlat.lat);
|
this.moveTo(lonlat, this.zoom, {noEvent: true});
|
||||||
this.moveTo(lonlat, this.zoom, {
|
|
||||||
'noEvent': true
|
|
||||||
});
|
|
||||||
this.events.triggerEvent("moveend");
|
this.events.triggerEvent("moveend");
|
||||||
}, this)
|
}, this)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user