Oops, didn't mean to check in changes to Navigation.js in r2867. Undo.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2868 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2007-03-23 14:23:58 +00:00
parent f99d1ce7b0
commit f218ad4508

View File

@@ -59,35 +59,20 @@ OpenLayers.Control.Navigation.prototype =
return false;
},
wheelChange: function(evt, deltaZ) {
console.log("wheel " + deltaZ);
var newZoom = this.map.getZoom() + deltaZ;
if (!this.map.isValidZoomLevel(newZoom)) return;
var size = this.map.getSize();
var deltaX = size.w/2 - evt.xy.x;
var deltaY = size.h/2 - evt.xy.y;
var newRes = map.baseLayer.resolutions[newZoom];
var zoomPoint = this.map.getLonLatFromPixel(evt.xy);
var newCenter = new OpenLayers.LonLat(
zoomPoint.lon + deltaX * newRes,
zoomPoint.lat - deltaY * newRes );
console.log(newCenter.toString());
this.map.setCenter( newCenter, newZoom );
},
/** User spun scroll wheel up
*
*/
wheelUp: function(evt) {
this.wheelChange(evt, 1);
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),
this.map.getZoom() + 1);
},
/** User spun scroll wheel down
*
*/
wheelDown: function(evt) {
this.wheelChange(evt, -1);
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),
this.map.getZoom() - 1);
},
/** @final @type String */