Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
Release 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Mukuthu committed Dec 12, 2016
1 parent 4259638 commit 589732f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "angular-snapscroll",
"version": "1.1.0",
"version": "1.2.0",
"authors": [
"Joel Mukuthu <joelmukuthu@gmail.com>"
],
Expand Down
42 changes: 29 additions & 13 deletions dist/angular-snapscroll.js
@@ -1,9 +1,9 @@
/**
* angular-snapscroll
* Version: 1.1.0
* Version: 1.2.0
* (c) 2014-2016 Joel Mukuthu
* MIT License
* Built on: 10-11-2016 18:25:46 GMT+0100
* Built on: 12-12-2016 21:13:13 GMT+0100
**/

(function () {
Expand Down Expand Up @@ -197,7 +197,8 @@
snapIndex !== previousCompositeIndex[0];
if (isSnapIndexChanged) {
var returnValue = scope.beforeSnap({
snapIndex: snapIndex
snapIndex: snapIndex,
$event: scope.sourceEvent
});
if (returnValue === false) {
if (isDefined(previousCompositeIndex)) {
Expand All @@ -218,9 +219,11 @@
)).then(function () {
if (isSnapIndexChanged) {
scope.afterSnap({
snapIndex: snapIndex
snapIndex: snapIndex,
$event: scope.sourceEvent
});
}
scope.sourceEvent = undefined;
});
}

Expand Down Expand Up @@ -431,7 +434,7 @@
return compositeIndex;
}

function snap(direction, source) {
function snap(direction, event) {
if (!isScrollable()) {
return;
}
Expand Down Expand Up @@ -462,12 +465,13 @@
return;
}

if (source === 'wheel') {
if (event.type === 'wheel') {
direction === 'up' && (scope.preventUp = true);
direction === 'down' && (scope.preventDown = true);
}

scope.$apply(function () {
scope.sourceEvent = event;
scope.compositeIndex = rectifyCompositeIndex(
newCompositeIndex
);
Expand All @@ -476,33 +480,41 @@
return true;
}

function snapUp(source) {
return snap('up', source);
function snapUp(event) {
return snap('up', event);
}

function snapDown(source) {
return snap('down', source);
function snapDown(event) {
return snap('down', event);
}

function bindWheel() {
if (scope.disableWheelBinding || scope.wheelBound) {
return;
}
wheelie.bind(element, {
up: function (e) {
e.preventDefault();
if (snapUp('wheel')) {
if (snapUp(e)) {
e.stopPropagation();
}
},
down: function (e) {
e.preventDefault();
if (snapDown('wheel')) {
if (snapDown(e)) {
e.stopPropagation();
}
}
}, scope.ignoreWheelClass);
scope.wheelBound = true;
}

function unbindWheel() {
if (!scope.wheelBound) {
return;
}
wheelie.unbind(element);
scope.wheelBound = false;
}

function setHeight(angularElement, height) {
Expand Down Expand Up @@ -663,7 +675,7 @@
}
if (handler) {
e.preventDefault();
handler();
handler(e);
}
}

Expand Down Expand Up @@ -731,6 +743,10 @@
scope.snapAnimation = true;
}

scope.disableWheelBinding = isDefined(
attributes.disableWheelBinding
);

scope.enableArrowKeys = isDefined(
attributes.enableArrowKeys
);
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-snapscroll.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "angular-snapscroll",
"version": "1.1.0",
"version": "1.2.0",
"description": "Vertical scroll-and-snap functionality in angular",
"main": "dist/angular-snapscroll.js",
"directories": {
Expand Down

0 comments on commit 589732f

Please sign in to comment.