Correct center setting, thanks @elemoine

This commit is contained in:
Tom Payne
2013-03-09 01:31:14 +01:00
parent 47f1b8cb0a
commit fe3b8d862d
+3 -1
View File
@@ -263,13 +263,15 @@ goog.exportProperty(
*/ */
ol.View2D.prototype.pan = function(map, delta, opt_duration) { ol.View2D.prototype.pan = function(map, delta, opt_duration) {
var currentCenter = this.getCenter(); var currentCenter = this.getCenter();
if (goog.isDef(currentCenter) && goog.isDef(opt_duration)) { if (goog.isDef(currentCenter)) {
if (goog.isDef(opt_duration)) {
map.requestRenderFrame(); map.requestRenderFrame();
map.addPreRenderFunction(ol.animation.pan({ map.addPreRenderFunction(ol.animation.pan({
source: currentCenter, source: currentCenter,
duration: opt_duration, duration: opt_duration,
easing: ol.easing.linear easing: ol.easing.linear
})); }));
}
this.setCenter(new ol.Coordinate( this.setCenter(new ol.Coordinate(
currentCenter.x + delta.x, currentCenter.y + delta.y)); currentCenter.x + delta.x, currentCenter.y + delta.y));
} }