remove unnecessary dependencies

This commit is contained in:
Gabriel Bazán 2016-05-18 17:04:22 -03:00 committed by Javier
parent d468c28cd0
commit 75be28b3bf
3 changed files with 1 additions and 70 deletions

View File

@ -129,8 +129,7 @@ module.exports = function(grunt) {
src: [
'bower_components/angular/angular-csp.css',
'bower_components/foundation/css/foundation.css',
'bower_components/animate.css/animate.css',
'bower_components/angular-ui-switch/angular-ui-switch.css'
'bower_components/animate.css/animate.css'
],
dest: 'public/css/foundation.css',
},

View File

@ -14,7 +14,6 @@
"angular-moment": "0.10.1",
"angular-qrcode": "monospaced/angular-qrcode#~6.2.1",
"angular-ui-router": "0.2.18",
"angular-ui-switch": "0.1.1",
"animate.css": "3.5.1",
"foundation": "5.5.3",
"foundation-icon-fonts": "*",

View File

@ -1,67 +0,0 @@
'use strict';
/*
* This is a modification from https://github.com/angular/angular.js/blob/master/src/ngTouch/swipe.js
*/
function makeSwipeDirective(directiveName, direction, eventName) {
angular.module('copayApp.directives')
.directive(directiveName, ['$parse', '$swipe',
function($parse, $swipe) {
// The maximum vertical delta for a swipe should be less than 75px.
var MAX_VERTICAL_DISTANCE = 75;
// Vertical distance should not be more than a fraction of the horizontal distance.
var MAX_VERTICAL_RATIO = 0.4;
// At least a 30px lateral motion is necessary for a swipe.
var MIN_HORIZONTAL_DISTANCE = 30;
return function(scope, element, attr) {
var swipeHandler = $parse(attr[directiveName]);
var startCoords, valid;
function validSwipe(coords) {
// Check that it's within the coordinates.
// Absolute vertical distance must be within tolerances.
// Horizontal distance, we take the current X - the starting X.
// This is negative for leftward swipes and positive for rightward swipes.
// After multiplying by the direction (-1 for left, +1 for right), legal swipes
// (ie. same direction as the directive wants) will have a positive delta and
// illegal ones a negative delta.
// Therefore this delta must be positive, and larger than the minimum.
if (!startCoords) return false;
var deltaY = Math.abs(coords.y - startCoords.y);
var deltaX = (coords.x - startCoords.x) * direction;
return valid && // Short circuit for already-invalidated swipes.
deltaY < MAX_VERTICAL_DISTANCE &&
deltaX > 0 &&
deltaX > MIN_HORIZONTAL_DISTANCE &&
deltaY / deltaX < MAX_VERTICAL_RATIO;
}
var pointerTypes = ['touch'];
$swipe.bind(element, {
'start': function(coords, event) {
startCoords = coords;
valid = true;
},
'move': function(coords, event) {
if (validSwipe(coords)) {
scope.$apply(function() {
element.triggerHandler(eventName);
swipeHandler(scope, {
$event: event
});
});
}
}
}, pointerTypes);
};
}
]);
}
// Left is negative X-coordinate, right is positive.
makeSwipeDirective('ngSwipeLeft', -1, 'swipeleft');
makeSwipeDirective('ngSwipeRight', 1, 'swiperight');