mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
chore(ngMobile): rename module ngTouch and file to angular-touch.js
BREAKING CHANGE: since all the code in the ngMobile module is touch related, we are renaming the module to ngTouch. To migrate, please replace all references to "ngMobile" with "ngTouch" and "angular-mobile.js" to "angular-touch.js". Closes #3526
This commit is contained in:
parent
0d17838a08
commit
94ec84e7b9
11 changed files with 33 additions and 33 deletions
14
Gruntfile.js
14
Gruntfile.js
|
|
@ -124,13 +124,13 @@ module.exports = function(grunt) {
|
|||
dest: 'build/angular-loader.js',
|
||||
src: util.wrap(['src/loader.js'], 'loader')
|
||||
},
|
||||
mobile: {
|
||||
dest: 'build/angular-mobile.js',
|
||||
touch: {
|
||||
dest: 'build/angular-touch.js',
|
||||
src: util.wrap([
|
||||
'src/ngMobile/mobile.js',
|
||||
'src/ngMobile/swipe.js',
|
||||
'src/ngMobile/directive/ngClick.js',
|
||||
'src/ngMobile/directive/ngSwipe.js'
|
||||
'src/ngTouch/touch.js',
|
||||
'src/ngTouch/swipe.js',
|
||||
'src/ngTouch/directive/ngClick.js',
|
||||
'src/ngTouch/directive/ngSwipe.js'
|
||||
], 'module')
|
||||
},
|
||||
mocks: {
|
||||
|
|
@ -174,7 +174,7 @@ module.exports = function(grunt) {
|
|||
animate: 'build/angular-animate.js',
|
||||
cookies: 'build/angular-cookies.js',
|
||||
loader: 'build/angular-loader.js',
|
||||
mobile: 'build/angular-mobile.js',
|
||||
touch: 'build/angular-touch.js',
|
||||
resource: 'build/angular-resource.js',
|
||||
route: 'build/angular-route.js',
|
||||
sanitize: 'build/angular-sanitize.js'
|
||||
|
|
|
|||
12
angularFiles.js
vendored
12
angularFiles.js
vendored
|
|
@ -75,10 +75,10 @@ angularFiles = {
|
|||
'src/ngSanitize/sanitize.js',
|
||||
'src/ngSanitize/filter/linky.js',
|
||||
'src/ngMock/angular-mocks.js',
|
||||
'src/ngMobile/mobile.js',
|
||||
'src/ngMobile/swipe.js',
|
||||
'src/ngMobile/directive/ngClick.js',
|
||||
'src/ngMobile/directive/ngSwipe.js',
|
||||
'src/ngTouch/touch.js',
|
||||
'src/ngTouch/swipe.js',
|
||||
'src/ngTouch/directive/ngClick.js',
|
||||
'src/ngTouch/directive/ngSwipe.js',
|
||||
'docs/components/angular-bootstrap/bootstrap.js'
|
||||
],
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ angularFiles = {
|
|||
'test/ngRoute/**/*.js',
|
||||
'test/ngSanitize/**/*.js',
|
||||
'test/ngMock/*.js',
|
||||
'test/ngMobile/**/*.js'
|
||||
'test/ngTouch/**/*.js'
|
||||
],
|
||||
|
||||
'karma': [
|
||||
|
|
@ -150,7 +150,7 @@ angularFiles = {
|
|||
'test/ngRoute/**/*.js',
|
||||
'test/ngResource/*.js',
|
||||
'test/ngSanitize/**/*.js',
|
||||
'test/ngMobile/**/*.js'
|
||||
'test/ngTouch/**/*.js'
|
||||
],
|
||||
|
||||
'karmaJquery': [
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
addTag('script', {src: path('angular-route.js') }, sync);
|
||||
addTag('script', {src: path('angular-cookies.js') }, sync);
|
||||
addTag('script', {src: path('angular-sanitize.js') }, sync);
|
||||
addTag('script', {src: path('angular-mobile.js') }, sync);
|
||||
addTag('script', {src: path('angular-touch.js') }, sync);
|
||||
addTag('script', {src: path('angular-animate.js') }, sync);
|
||||
addTag('script', {src: 'components/angular-bootstrap.js' }, sync);
|
||||
addTag('script', {src: 'components/angular-bootstrap-prettify.js' }, sync);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module.exports = function(config) {
|
|||
'build/angular-cookies.js',
|
||||
'build/angular-mocks.js',
|
||||
'build/angular-resource.js',
|
||||
'build/angular-mobile.js',
|
||||
'build/angular-touch.js',
|
||||
'build/angular-sanitize.js',
|
||||
'build/angular-route.js',
|
||||
'build/angular-animate.js',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc directive
|
||||
* @name ngMobile.directive:ngClick
|
||||
* @name ngTouch.directive:ngClick
|
||||
*
|
||||
* @description
|
||||
* A more powerful replacement for the default ngClick designed to be used on touchscreen
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
</doc:example>
|
||||
*/
|
||||
|
||||
ngMobile.config(['$provide', function($provide) {
|
||||
ngTouch.config(['$provide', function($provide) {
|
||||
$provide.decorator('ngClickDirective', ['$delegate', function($delegate) {
|
||||
// drop the default ngClick directive
|
||||
$delegate.shift();
|
||||
|
|
@ -39,7 +39,7 @@ ngMobile.config(['$provide', function($provide) {
|
|||
}]);
|
||||
}]);
|
||||
|
||||
ngMobile.directive('ngClick', ['$parse', '$timeout', '$rootElement',
|
||||
ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
|
||||
function($parse, $timeout, $rootElement) {
|
||||
var TAP_DURATION = 750; // Shorter than 750ms is a tap, longer is a taphold or drag.
|
||||
var MOVE_TOLERANCE = 12; // 12px seems to work in most mobile browsers.
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc directive
|
||||
* @name ngMobile.directive:ngSwipeLeft
|
||||
* @name ngTouch.directive:ngSwipeLeft
|
||||
*
|
||||
* @description
|
||||
* Specify custom behavior when an element is swiped to the left on a touchscreen device.
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc directive
|
||||
* @name ngMobile.directive:ngSwipeRight
|
||||
* @name ngTouch.directive:ngSwipeRight
|
||||
*
|
||||
* @description
|
||||
* Specify custom behavior when an element is swiped to the right on a touchscreen device.
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
*/
|
||||
|
||||
function makeSwipeDirective(directiveName, direction, eventName) {
|
||||
ngMobile.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) {
|
||||
ngTouch.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.
|
||||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name ngMobile.$swipe
|
||||
* @name ngTouch.$swipe
|
||||
*
|
||||
* @description
|
||||
* The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe
|
||||
* behavior, to make implementing swipe-related directives more convenient.
|
||||
*
|
||||
* It is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngMobile`, and by
|
||||
* It is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`, and by
|
||||
* `ngCarousel` in a separate component.
|
||||
*
|
||||
* # Usage
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* documentation for `bind` below.
|
||||
*/
|
||||
|
||||
ngMobile.factory('$swipe', [function() {
|
||||
ngTouch.factory('$swipe', [function() {
|
||||
// The total distance in any direction before we make the call on swipe vs. scroll.
|
||||
var MOVE_BUFFER_RADIUS = 10;
|
||||
|
||||
|
|
@ -37,8 +37,8 @@ ngMobile.factory('$swipe', [function() {
|
|||
return {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ngMobile.$swipe#bind
|
||||
* @methodOf ngMobile.$swipe
|
||||
* @name ngTouch.$swipe#bind
|
||||
* @methodOf ngTouch.$swipe
|
||||
*
|
||||
* @description
|
||||
* The main method of `$swipe`. It takes an element to be watched for swipe motions, and an
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name ngMobile
|
||||
* @name ngTouch
|
||||
* @description
|
||||
* Touch events and other mobile helpers.
|
||||
* Based on jQuery Mobile touch event handling (jquerymobile.com)
|
||||
*/
|
||||
|
||||
// define ngMobile module
|
||||
var ngMobile = angular.module('ngMobile', []);
|
||||
// define ngTouch module
|
||||
var ngTouch = angular.module('ngTouch', []);
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
describe('ngClick (mobile)', function() {
|
||||
describe('ngClick (touch)', function() {
|
||||
var element, time, orig_now;
|
||||
|
||||
// TODO(braden): Once we have other touch-friendly browsers on CI, allow them here.
|
||||
|
|
@ -16,7 +16,7 @@ describe('ngClick (mobile)', function() {
|
|||
|
||||
|
||||
beforeEach(function() {
|
||||
module('ngMobile');
|
||||
module('ngTouch');
|
||||
orig_now = Date.now;
|
||||
time = 0;
|
||||
Date.now = mockTime;
|
||||
|
|
@ -23,7 +23,7 @@ var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent,
|
|||
}
|
||||
|
||||
beforeEach(function() {
|
||||
module('ngMobile');
|
||||
module('ngTouch');
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
|
@ -23,7 +23,7 @@ var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent,
|
|||
}
|
||||
|
||||
beforeEach(function() {
|
||||
module('ngMobile');
|
||||
module('ngTouch');
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
Loading…
Reference in a new issue