Skip to content

Commit

Permalink
chore(package) add new dependencies
Browse files Browse the repository at this point in the history
choreGruntfile) add watck task
chore(bower) change main file
  • Loading branch information
wzr1337 committed Oct 29, 2014
1 parent 7b3a9a7 commit 55d9782
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 13 deletions.
10 changes: 9 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);

grunt.initConfig({
concat : {
Expand All @@ -13,6 +14,12 @@ module.exports = function(grunt) {
}
}
},
watch: {
js: {
files: ['src/{,*/}*.js'],
tasks: ['build']
}
},
clean : {
dist : {
files : [ {
Expand Down Expand Up @@ -54,4 +61,5 @@ module.exports = function(grunt) {
]);

grunt.registerTask('default', [ 'build' ]);
grunt.registerTask('watchme', [ 'watch' ]);
};
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "angular-gestures",
"description": "AngularJS directive that adds support for multi touch gestures to your app. Based on hammer.js.",
"version": "0.2.3",
"main": ["gestures.js"],
"main": ["dist/gestures.min.js"],
"homepage": "http://github.com/wzr1337/angular-gestures",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion demo/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<script src="bower_components/bootstrap-sass/js/bootstrap-scrollspy.js"></script>
<script src="bower_components/bootstrap-sass/js/bootstrap-collapse.js"></script>
<script src="bower_components/bootstrap-sass/js/bootstrap-tab.js"></script>
<script src="bower_components/angular-gestures/gestures.min.js"></script>
<script src="bower_components/angular-gestures/dist/gestures.min.js"></script>
<!-- endbuild -->

<!-- build:js({.tmp,app}) scripts/scripts.js -->
Expand Down
27 changes: 24 additions & 3 deletions dist/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
# angular-gestures

AngularJS directive that adds support for multi touch gestures to your app. Based on hammer.js.
AngularJS directive that adds support for multi touch gestures to your app, based on hammer.js.

## Usage

* Include `gestures.js` or `gestures.min.js` into your page
* Declare `'angular-gestures'` as a dependency for your angular app: `angular.module('myApp', ['angular-gestures']);`
* Use attributes on you containers in the same way you use `ng-click` e.g. `hm-tap="add_something()"`
* Use attributes on containers the same way you use `ng-click`: e.g. `hm-tap`
```HTML
<button hm-tap="add_something()">Tap me</button>
```
* You can use angular interpolations like this : `hm-swipe="remove_something({{ id }})"`
* You can also use Hammer.js options by e.g. `hm-tap-opts="{hold: false}"`

### Event data

Pass the `$event` object in the usual way e.g. `hm-drag="myDrag($event)"` then access its internals like so:
```JS
$scope.myDrag = function(event) {
console.log(event.gesture);
}
```
Refer to the [Hammer.js docs](https://github.com/EightMedia/hammer.js/wiki/Getting-Started) for more details on the properties of `event`.

## Supported events


* hmDoubleTap : 'doubletap',
* hmDragstart : 'dragstart',
* hmDrag : 'drag',
* hmDragUp : 'dragup',
* hmDragDown : 'dragdown',
* hmDragLeft : 'dragleft',
* hmDragRight : 'dragright',
* hmDragEnd : 'dragend',
* hmDragend : 'dragend',
* hmHold : 'hold',
* hmPinch : 'pinch',
* hmPinchIn : 'pinchin',
Expand All @@ -36,6 +51,12 @@ AngularJS directive that adds support for multi touch gestures to your app. Base
* hmTransform : 'transform',
* hmTransformend : 'transformend'


All [Hammerjs events](https://github.com/EightMedia/hammer.js/wiki/Getting-Started) are supported. The corresponding Angularjs attribute has `hm-` prepended to the name. So for example, the 'doubletap' event becomes `hm-double-tap` etc.

*Attention* : *end and *start events are NOT CamelCased because of issues caused by $animate interference.


## Bower
If you want to use angular-momentum-scroll with bower, add the following dependency to your component.json

Expand Down
2 changes: 1 addition & 1 deletion dist/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "angular-gestures",
"description": "AngularJS directive that adds support for multi touch gestures to your app. Based on hammer.js.",
"version": "0.2.3",
"main": ["gestures.js"],
"main": ["dist/gestures.min.js"],
"homepage": "http://github.com/wzr1337/angular-gestures",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion dist/gestures.min.js

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.4.0",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-jshint": "~0.3.0",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-compress": "~0.4.9",
"matchdep": "~0.1.1"
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-copy": "~0.4.0",
"grunt-contrib-jshint": "~0.3.0",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "^0.6.1",
"load-grunt-tasks": "^1.0.0",
"matchdep": "~0.1.1",
"time-grunt": "^1.0.0"
}
}

0 comments on commit 55d9782

Please sign in to comment.