Implement Drag-to-Zoom for ticket #30.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@216 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -220,8 +220,8 @@ OpenLayers.Map.prototype = {
|
||||
*/
|
||||
getZoomForExtent: function (bounds) {
|
||||
var size = this.getSize();
|
||||
var deg_per_pixel = bounds.getWidth() / size.w;
|
||||
var zoom = Math.log(deg_per_pixel / this.maxResolution) / Math.log(2);
|
||||
var deg_per_pixel = (bounds.getWidth() > bounds.getHeight() ? bounds.getWidth() / size.w : bounds.getHeight() / size.h);
|
||||
var zoom = -( Math.log(deg_per_pixel / this.maxResolution) / Math.log(2) );
|
||||
return Math.floor(Math.max(zoom, 0));
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user