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:
crschmidt
2006-05-20 22:18:44 +00:00
parent e7c6d4df19
commit 24eb8fe144
2 changed files with 52 additions and 12 deletions

View File

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