Skip to content

Commit

Permalink
add deltaXFactor, deltaYFactor, deltaZFactor
Browse files Browse the repository at this point in the history
  • Loading branch information
joneit committed May 24, 2018
1 parent abb2500 commit b727f54
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "finbars",
"version": "1.5.2",
"version": "1.6.0",
"main": "index.js",
"description": "Styleable scrollbars for real or virtual content",
"repository": {
Expand Down
35 changes: 28 additions & 7 deletions src/finbars.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ function FinBar(options) {

// make bound versions of all the mouse event handler
var bound = this._bound = {};
for (key in handlersToBeBound) {
Object.keys(handlersToBeBound).forEach(function(key) {
bound[key] = handlersToBeBound[key].bind(this);
}
}, this);

/**
* @name thumb
Expand Down Expand Up @@ -74,9 +74,9 @@ function FinBar(options) {
this._max = 100;

// options
for (var key in options) {
if (options.hasOwnProperty(key)) {
var option = options[key];
Object.keys(options).forEach(function(key) {
var option = options[key];
if (option !== undefined) {
switch (key) {

case 'index':
Expand All @@ -103,7 +103,7 @@ function FinBar(options) {

}
}
}
}, this);

cssInjector(cssFinBars, 'finbar-base', options.cssStylesheetReferenceElement);
}
Expand Down Expand Up @@ -230,6 +230,27 @@ FinBar.prototype = {
*/
increment: 1,

/**
* Default value of multiplier for `WheelEvent#deltaX` (horizontal scrolling delta).
* @default
* @memberOf FinBar.prototype
*/
deltaXFactor: 1,

/**
* Default value of multiplier for `WheelEvent#deltaY` (vertical scrolling delta).
* @default
* @memberOf FinBar.prototype
*/
deltaYFactor: 1,

/**
* Default value of multiplier for `WheelEvent#deltaZ` (delpth scrolling delta).
* @default
* @memberOf FinBar.prototype
*/
deltaZFactor: 1,

/**
* @name barStyles
* @summary Scrollbar styles to be applied by {@link FinBar#resize|resize()}.
Expand Down Expand Up @@ -660,7 +681,7 @@ var handlersToBeBound = {
},

onwheel: function (evt) {
this.index += evt[this.deltaProp];
this.index += evt[this.deltaProp] * this[this.deltaProp + 'Factor'];
evt.stopPropagation();
evt.preventDefault();
},
Expand Down

0 comments on commit b727f54

Please sign in to comment.