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); };