Skip to content
This repository was archived by the owner on Mar 27, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/wheel/wheel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
e.preventDefault();

var wheelDeltaX, wheelDeltaY,
newX, newY,
newX, newY, doBounce = false,
that = this;

if ( this.wheelTimeout === undefined ) {
Expand Down Expand Up @@ -91,19 +91,34 @@
this.directionX = wheelDeltaX > 0 ? -1 : wheelDeltaX < 0 ? 1 : 0;
this.directionY = wheelDeltaY > 0 ? -1 : wheelDeltaY < 0 ? 1 : 0;

if (this.lastDirectionX !== this.directionX || this.lastDirectionY !== this.directionY) {
// Cancel animation
this.isAnimating = false;
}
this.scrollTo(newX, newY, 0);

this.lastDirectionX = this.directionX;
this.lastDirectionY = this.directionY;

if ( newX > 0 ) {
newX = 0;
doBounce = true;
} else if ( newX < this.maxScrollX ) {
newX = this.maxScrollX;
doBounce = true;
}

if ( newY > 0 ) {
newY = 0;
doBounce = true;
} else if ( newY < this.maxScrollY ) {
newY = this.maxScrollY;
doBounce = true;
}

this.scrollTo(newX, newY, 0);
if (doBounce && this.options.bounce) {
this.scrollTo(newX, newY, this.options.bounceTime);
}


// INSERT POINT: _wheel
},