Since VirtualEarth doesn't understand bounds at all, this function didn't work.

This is not an ideal situation, becauuse it's not really 100% correct for a 
mercator projection, but it does cause things to work.

It seems that for some reason, the EventPane isn't actually catching all the 
move events -- this seems to be what is causing the slow dragging. I'm not 
sure of the reason for this, but maybe Erik or someone else will be able to 
offer hints. I could also just be wrong ;) I just know it's slow, really.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1208 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-08-15 02:15:03 +00:00
parent 846a11a004
commit 9984c776de

View File

@@ -212,12 +212,25 @@ OpenLayers.Layer.VirtualEarth.prototype =
* @type int
*/
getZoomForExtent: function (bounds) {
var zoom = null;
if (this.vemap != null) {
var gBounds = this.getVELatLongBoundsFromOLBounds(bounds);
var gZoom = this.vemap.getBoundsZoomLevel(gBounds);
zoom = this.getOLZoomFromGZoom(gZoom);
}
var maxRes = this.map.getMaxResolution();
var viewSize = this.map.getSize();
var width = bounds.getWidth();
var height = bounds.getHeight();
var degPerPixel = (width > height) ? width / viewSize.w
: height / viewSize.h;
var zoom = Math.floor( (Math.log(maxRes/degPerPixel)) / Math.log(2) );
var maxZoomLevel = this.map.getMaxZoomLevel();
var minZoomLevel = this.map.getMinZoomLevel();
//make sure zoom is within bounds
zoom = Math.min( Math.max(zoom, minZoomLevel),
maxZoomLevel );
return zoom;
},