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:
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user