[OpenLayers-Users] weird zoom behavior mouse wheel vs double click
Alessandro Ferrucci
alessandroferrucci at gmail.com
Sun Jul 24 13:06:56 EDT 2011
Hello,
I have the following very simple map initialization code for
OpenLayers with google maps:
var map;
var projectionWGS84 = new OpenLayers.Projection("EPSG:4326");
var projectionMercator = new OpenLayers.Projection("EPSG:900913");
// Avoid pink error tiles
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
OpenLayers.Util.onImageLoadErrorColor = "transparent";
function init(){
var options = {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
numZoomLevels: 20,
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(-20037508,
-20037508,20037508, 20037508),
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.ArgParser(),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.PanZoomBar({
position: new OpenLayers.Pixel(2, 15) }),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.Scale($('scale')),
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.Permalink()
]
};
map = new OpenLayers.Map('map',options);
var googleStreetLayer = new
OpenLayers.Layer.Google("Google Street", {'sphericalMercator':true} );
map.addLayers([googleStreetLayer]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MousePosition());
var USABounds=new
OpenLayers.Bounds(-124.731,24.956,-66.97,49.372);
USABounds.transform(projectionWGS84,map.getProjectionObject());
// map.zoomToMaxExtent();
map.zoomToExtent(USABounds);
}
This works fine however, the zoom behavior is weird when I zoom in and
out using the mouse wheel.
When I double click on the map the map zooms in 1 tick mark fine,
however when I use the mouse wheel to zoom in and out, it zooms 2
ticks at a time.
Has anyone ever encountered this behavior? Any hints as to why it
would work as such?
I am using the following OpenLayers
<script src="http://openlayers.org/api/OpenLayers.js"
type="text/javascript"></script>
Thank you,
Alessandro Ferrucci
More information about the Users
mailing list