From 00917b72628f9d5ed1bd7121250baa988ec5a91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Thu, 27 Feb 2014 10:16:18 +0100 Subject: [PATCH] Export ol.View2D#rotate --- src/ol/view2d.exports | 1 + src/ol/view2d.js | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ol/view2d.exports b/src/ol/view2d.exports index 01d44dd7b5..e665804784 100644 --- a/src/ol/view2d.exports +++ b/src/ol/view2d.exports @@ -7,4 +7,5 @@ @exportProperty ol.View2D.prototype.centerOn @exportProperty ol.View2D.prototype.getView2D @exportProperty ol.View2D.prototype.getZoom +@exportProperty ol.View2D.prototype.rotate @exportProperty ol.View2D.prototype.setZoom diff --git a/src/ol/view2d.js b/src/ol/view2d.js index 3f82ed736c..e8df7039b1 100644 --- a/src/ol/view2d.js +++ b/src/ol/view2d.js @@ -537,12 +537,14 @@ ol.View2D.prototype.isDef = function() { /** * Rotate the view around a given coordinate. * @param {number} rotation New rotation value for the view. - * @param {ol.Coordinate} anchor The rotation center. + * @param {ol.Coordinate=} opt_anchor The rotation center. */ -ol.View2D.prototype.rotate = function(rotation, anchor) { - var center = this.calculateCenterRotate(rotation, anchor); +ol.View2D.prototype.rotate = function(rotation, opt_anchor) { + if (goog.isDef(opt_anchor)) { + var center = this.calculateCenterRotate(rotation, opt_anchor); + this.setCenter(center); + } this.setRotation(rotation); - this.setCenter(center); };