From 507d8021b1c91cc0cefc0418e61b04597ad1030b Mon Sep 17 00:00:00 2001 From: Adam Kent Date: Tue, 8 Oct 2013 14:49:56 +1100 Subject: 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 --- src/ngTouch/swipe.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/ngTouch/swipe.js') 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); }); } }; -- cgit v1.2.3