rename setScale() to zoomToScale() and move it down a few lines in the code
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1200 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -835,25 +835,6 @@ OpenLayers.Map.prototype = {
|
||||
/* */
|
||||
/********************************************************/
|
||||
|
||||
/** zoom to a specified scale
|
||||
*
|
||||
* @param {float} scale
|
||||
*/
|
||||
setScale: function(scale) {
|
||||
var res = OpenLayers.Util.getResolutionFromScale(scale, this.baseLayer.units);
|
||||
var size = this.getSize();
|
||||
var w_deg = size.w * res;
|
||||
var h_deg = size.h * res;
|
||||
var center = this.getCenter();
|
||||
|
||||
var extent = new OpenLayers.Bounds(center.lon - w_deg / 2,
|
||||
center.lat - h_deg / 2,
|
||||
center.lon + w_deg / 2,
|
||||
center.lat + h_deg / 2);
|
||||
this.zoomToExtent(extent);
|
||||
|
||||
},
|
||||
|
||||
/** Zoom to a specific zoom level
|
||||
*
|
||||
* @param {int} zoom
|
||||
@@ -900,6 +881,25 @@ OpenLayers.Map.prototype = {
|
||||
this.zoomToExtent(this.getMaxExtent());
|
||||
},
|
||||
|
||||
/** zoom to a specified scale
|
||||
*
|
||||
* @param {float} scale
|
||||
*/
|
||||
zoomToScale: function(scale) {
|
||||
var res = OpenLayers.Util.getResolutionFromScale(scale,
|
||||
this.baseLayer.units);
|
||||
var size = this.getSize();
|
||||
var w_deg = size.w * res;
|
||||
var h_deg = size.h * res;
|
||||
var center = this.getCenter();
|
||||
|
||||
var extent = new OpenLayers.Bounds(center.lon - w_deg / 2,
|
||||
center.lat - h_deg / 2,
|
||||
center.lon + w_deg / 2,
|
||||
center.lat + h_deg / 2);
|
||||
this.zoomToExtent(extent);
|
||||
},
|
||||
|
||||
/********************************************************/
|
||||
/* */
|
||||
/* Translation Functions */
|
||||
|
||||
Reference in New Issue
Block a user