-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f04c594
commit 95e35f1
Showing
9 changed files
with
66 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
angular:[email protected] | ||
danialf:[email protected].3 | ||
danialf:[email protected].4 | ||
[email protected] | ||
[email protected] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* progress, resize, thumbnail, preview, validation and CORS | ||
* FileAPI Flash shim for old browsers not supporting FormData | ||
* @author Danial <[email protected]> | ||
* @version 12.2.4 | ||
* @version 12.2.5 | ||
*/ | ||
|
||
(function () { | ||
|
@@ -424,7 +424,7 @@ if (!window.FileReader) { | |
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, | ||
* progress, resize, thumbnail, preview, validation and CORS | ||
* @author Danial <[email protected]> | ||
* @version 12.2.4 | ||
* @version 12.2.5 | ||
*/ | ||
|
||
if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | ||
|
@@ -445,7 +445,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | |
|
||
var ngFileUpload = angular.module('ngFileUpload', []); | ||
|
||
ngFileUpload.version = '12.2.4'; | ||
ngFileUpload.version = '12.2.5'; | ||
|
||
ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) { | ||
var upload = this; | ||
|
@@ -1210,13 +1210,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |
return fileElem; | ||
} | ||
|
||
var initialTouchStartY = 0; | ||
|
||
function clickHandler(evt) { | ||
if (elem.attr('disabled')) return false; | ||
if (attrGetter('ngfSelectDisabled', scope)) return; | ||
|
||
var r = handleTouch(evt); | ||
var r = detectSwipe(evt); | ||
// prevent the click if it is a swipe | ||
if (r != null) return r; | ||
|
||
resetModel(evt); | ||
|
@@ -1241,19 +1240,30 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |
return false; | ||
} | ||
|
||
function handleTouch(evt) { | ||
var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches); | ||
if (evt.type === 'touchstart') { | ||
initialTouchStartY = touches ? touches[0].clientY : 0; | ||
return true; // don't block event default | ||
} else { | ||
evt.stopPropagation(); | ||
evt.preventDefault(); | ||
|
||
// prevent scroll from triggering event | ||
if (evt.type === 'touchend') { | ||
var currentLocation = touches ? touches[0].clientY : 0; | ||
if (Math.abs(currentLocation - initialTouchStartY) > 20) return false; | ||
var initialTouchStartY = 0; | ||
var initialTouchStartX = 0; | ||
|
||
function detectSwipe(evt) { | ||
var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches); | ||
if (touches) { | ||
if (evt.type === 'touchstart') { | ||
initialTouchStartX = touches[0].clientX; | ||
initialTouchStartY = touches[0].clientY; | ||
return true; // don't block event default | ||
} else { | ||
// prevent scroll from triggering event | ||
if (evt.type === 'touchend') { | ||
var currentX = touches[0].clientX; | ||
var currentY = touches[0].clientY; | ||
if ((Math.abs(currentX - initialTouchStartX) > 20) || | ||
(Math.abs(currentY - initialTouchStartY) > 20)) { | ||
evt.stopPropagation(); | ||
evt.preventDefault(); | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
} | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* progress, resize, thumbnail, preview, validation and CORS | ||
* FileAPI Flash shim for old browsers not supporting FormData | ||
* @author Danial <[email protected]> | ||
* @version 12.2.4 | ||
* @version 12.2.5 | ||
*/ | ||
|
||
(function () { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort, | ||
* progress, resize, thumbnail, preview, validation and CORS | ||
* @author Danial <[email protected]> | ||
* @version 12.2.4 | ||
* @version 12.2.5 | ||
*/ | ||
|
||
if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | ||
|
@@ -23,7 +23,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) { | |
|
||
var ngFileUpload = angular.module('ngFileUpload', []); | ||
|
||
ngFileUpload.version = '12.2.4'; | ||
ngFileUpload.version = '12.2.5'; | ||
|
||
ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) { | ||
var upload = this; | ||
|
@@ -788,13 +788,12 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |
return fileElem; | ||
} | ||
|
||
var initialTouchStartY = 0; | ||
|
||
function clickHandler(evt) { | ||
if (elem.attr('disabled')) return false; | ||
if (attrGetter('ngfSelectDisabled', scope)) return; | ||
|
||
var r = handleTouch(evt); | ||
var r = detectSwipe(evt); | ||
// prevent the click if it is a swipe | ||
if (r != null) return r; | ||
|
||
resetModel(evt); | ||
|
@@ -819,19 +818,30 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload', | |
return false; | ||
} | ||
|
||
function handleTouch(evt) { | ||
var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches); | ||
if (evt.type === 'touchstart') { | ||
initialTouchStartY = touches ? touches[0].clientY : 0; | ||
return true; // don't block event default | ||
} else { | ||
evt.stopPropagation(); | ||
evt.preventDefault(); | ||
|
||
// prevent scroll from triggering event | ||
if (evt.type === 'touchend') { | ||
var currentLocation = touches ? touches[0].clientY : 0; | ||
if (Math.abs(currentLocation - initialTouchStartY) > 20) return false; | ||
var initialTouchStartY = 0; | ||
var initialTouchStartX = 0; | ||
|
||
function detectSwipe(evt) { | ||
var touches = evt.changedTouches || (evt.originalEvent && evt.originalEvent.changedTouches); | ||
if (touches) { | ||
if (evt.type === 'touchstart') { | ||
initialTouchStartX = touches[0].clientX; | ||
initialTouchStartY = touches[0].clientY; | ||
return true; // don't block event default | ||
} else { | ||
// prevent scroll from triggering event | ||
if (evt.type === 'touchend') { | ||
var currentX = touches[0].clientX; | ||
var currentY = touches[0].clientY; | ||
if ((Math.abs(currentX - initialTouchStartX) > 20) || | ||
(Math.abs(currentY - initialTouchStartY) > 20)) { | ||
evt.stopPropagation(); | ||
evt.preventDefault(); | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
} | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters