Skip to content

Commit

Permalink
Add ol.View2D.prototype.setZoom
Browse files Browse the repository at this point in the history
  • Loading branch information
elemoine committed Jul 4, 2013
1 parent a071c35 commit 0cf4024
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ol/view2d.exports
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
@exportProperty ol.View2D.prototype.constrainRotation
@exportProperty ol.View2D.prototype.fitExtent
@exportProperty ol.View2D.prototype.getView2D
@exportProperty ol.View2D.prototype.setZoom
10 changes: 10 additions & 0 deletions src/ol/view2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,16 @@ goog.exportProperty(
ol.View2D.prototype.setRotation);


/**
* Zoom to a specific zoom level.
* @param {number} zoom Zoom level.
*/
ol.View2D.prototype.setZoom = function(zoom) {
var resolution = this.constrainResolution(this.maxResolution_, zoom);
this.setResolution(resolution);
};


/**
* @private
* @param {ol.View2DOptions} options View2D options.
Expand Down

0 comments on commit 0cf4024

Please sign in to comment.