From fe3b8d862d6a8115d58dfcc91246a4c5f3d5855c Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sat, 9 Mar 2013 01:31:14 +0100 Subject: [PATCH] Correct center setting, thanks @elemoine --- src/ol/view2d.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ol/view2d.js b/src/ol/view2d.js index 39e83ee3f1..0f8bd61df6 100644 --- a/src/ol/view2d.js +++ b/src/ol/view2d.js @@ -263,13 +263,15 @@ goog.exportProperty( */ ol.View2D.prototype.pan = function(map, delta, opt_duration) { var currentCenter = this.getCenter(); - if (goog.isDef(currentCenter) && goog.isDef(opt_duration)) { - map.requestRenderFrame(); - map.addPreRenderFunction(ol.animation.pan({ - source: currentCenter, - duration: opt_duration, - easing: ol.easing.linear - })); + if (goog.isDef(currentCenter)) { + if (goog.isDef(opt_duration)) { + map.requestRenderFrame(); + map.addPreRenderFunction(ol.animation.pan({ + source: currentCenter, + duration: opt_duration, + easing: ol.easing.linear + })); + } this.setCenter(new ol.Coordinate( currentCenter.x + delta.x, currentCenter.y + delta.y)); }