Merge pull request #812 from ahocevar/mousewheel

Better mousewheel/touchpad behavior for zooming. r=@elemoine
This commit is contained in:
ahocevar
2013-02-14 01:13:56 -08:00
3 changed files with 34 additions and 14 deletions

View File

@@ -77,7 +77,9 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
/**
* Property: mouseWheelOptions
* {Object} Options passed to the MouseWheel control (only useful if
* <zoomWheelEnabled> is set to true)
* <zoomWheelEnabled> is set to true). Default is no options for maps
* with fractionalZoom set to true, otherwise
* {cumulative: false, interval: 50, maxDelta: 6}
*/
mouseWheelOptions: null,
@@ -208,10 +210,15 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
{map: this.map, keyMask: this.zoomBoxKeyMask});
this.dragPan.draw();
this.zoomBox.draw();
var wheelOptions = this.map.fractionalZoom ? {} : {
cumulative: false,
interval: 50,
maxDelta: 6
};
this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
this, {"up" : this.wheelUp,
"down": this.wheelDown},
this.mouseWheelOptions );
this, {up : this.wheelUp, down: this.wheelDown},
OpenLayers.Util.extend(wheelOptions, this.mouseWheelOptions)
);
if (OpenLayers.Control.PinchZoom) {
this.pinchZoom = new OpenLayers.Control.PinchZoom(
OpenLayers.Util.extend(