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:
@@ -59,35 +59,20 @@ OpenLayers.Control.Navigation.prototype =
|
|||||||
return false;
|
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
|
/** User spun scroll wheel up
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
wheelUp: function(evt) {
|
wheelUp: function(evt) {
|
||||||
this.wheelChange(evt, 1);
|
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),
|
||||||
|
this.map.getZoom() + 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** User spun scroll wheel down
|
/** User spun scroll wheel down
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
wheelDown: function(evt) {
|
wheelDown: function(evt) {
|
||||||
this.wheelChange(evt, -1);
|
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),
|
||||||
|
this.map.getZoom() - 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
|
|||||||
Reference in New Issue
Block a user