aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngTouch/swipe.js
diff options
context:
space:
mode:
authorAdam Kent2013-10-08 14:49:56 +1100
committerPete Bacon Darwin2013-10-08 12:55:16 +0100
commit507d8021b1c91cc0cefc0418e61b04597ad1030b (patch)
treefb58a88337d65c7d28f3883bcf5f86fd77aa1dfb /src/ngTouch/swipe.js
parentbed08c9c6661d6da5ed6337f194402ea02a8d14c (diff)
downloadangular.js-507d8021b1c91cc0cefc0418e61b04597ad1030b.tar.bz2
fix(ngTouch): add $event to ng-swipe
Existing documentation implies that an Event object should be available as `$event` on swipe directives, which previously was only working for `ng-click`. Closes #4071 Closes #4321
Diffstat (limited to 'src/ngTouch/swipe.js')
-rw-r--r--src/ngTouch/swipe.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ngTouch/swipe.js b/src/ngTouch/swipe.js
index 0ee4218e..4ad58121 100644
--- a/src/ngTouch/swipe.js
+++ b/src/ngTouch/swipe.js
@@ -83,12 +83,12 @@ ngTouch.factory('$swipe', [function() {
totalX = 0;
totalY = 0;
lastPos = startCoords;
- eventHandlers['start'] && eventHandlers['start'](startCoords);
+ eventHandlers['start'] && eventHandlers['start'](startCoords, event);
});
element.on('touchcancel', function(event) {
active = false;
- eventHandlers['cancel'] && eventHandlers['cancel']();
+ eventHandlers['cancel'] && eventHandlers['cancel'](event);
});
element.on('touchmove mousemove', function(event) {
@@ -116,20 +116,19 @@ ngTouch.factory('$swipe', [function() {
if (totalY > totalX) {
// Allow native scrolling to take over.
active = false;
- eventHandlers['cancel'] && eventHandlers['cancel']();
+ eventHandlers['cancel'] && eventHandlers['cancel'](event);
return;
} else {
// Prevent the browser from scrolling.
event.preventDefault();
-
- eventHandlers['move'] && eventHandlers['move'](coords);
+ eventHandlers['move'] && eventHandlers['move'](coords, event);
}
});
element.on('touchend mouseup', function(event) {
if (!active) return;
active = false;
- eventHandlers['end'] && eventHandlers['end'](getCoordinates(event));
+ eventHandlers['end'] && eventHandlers['end'](getCoordinates(event), event);
});
}
};