Add a cumulative mode in MouseWheel handler. r=ahocevar (closes #2450)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10002 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Frédéric Junod
2010-02-01 08:42:17 +00:00
parent 9b728d048d
commit 6223d7fd82
3 changed files with 56 additions and 3 deletions

View File

@@ -42,9 +42,18 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
* Property: delta
* {Integer} When interval is set, delta collects the mousewheel z-deltas
* of the events that occur within the interval.
* See also the cumulative option
*/
delta: 0,
/**
* Property: cumulative
* {Boolean} When interval is set: true to collect all the mousewheel
* z-deltas, false to only record the delta direction (positive or
* negative)
*/
cumulative: true,
/**
* Constructor: OpenLayers.Handler.MouseWheel
*
@@ -216,9 +225,9 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
);
}
if (delta < 0) {
this.callback("down", [e, delta]);
this.callback("down", [e, this.cumulative ? delta : -1]);
} else {
this.callback("up", [e, delta]);
this.callback("up", [e, this.cumulative ? delta : 1]);
}
}
},