Swipe left for list items in the works

This commit is contained in:
Max Lynch
2013-10-09 13:30:44 -05:00
parent a5b1a51e6e
commit 5af636989b
7 changed files with 1978 additions and 82 deletions

53
dist/ionic.js vendored
View File

@ -177,7 +177,7 @@ window.ionic = {
* Simple gesture controllers with some common gestures that emit
* gesture events.
*
* Ported from github.com/EightMedia/hammer.js - thanks!
* Ported from github.com/EightMedia/ionic.Gestures.js - thanks!
*/
(function(ionic) {
@ -265,17 +265,9 @@ window.ionic = {
ionic.Gestures.event.determineEventTypes();
// Register all gestures inside ionic.Gestures.gestures
if(this === this.window) {
// this is a window, then only allow the Tap gesture to be added
ionic.Gestures.detection.register(ionic.Gestures.gestures.Tap);
ionic.Gestures.detection.register(ionic.Gestures.gestures.Drag);
ionic.Gestures.detection.register(ionic.Gestures.gestures.Release);
} else {
// everything else but the window
for(var name in ionic.Gestures.gestures) {
if(ionic.Gestures.gestures.hasOwnProperty(name)) {
ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);
}
for(var name in ionic.Gestures.gestures) {
if(ionic.Gestures.gestures.hasOwnProperty(name)) {
ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);
}
}
@ -1784,6 +1776,43 @@ window.ionic = {
}
};
})(ionic);
;
(function(ionic) {
ionic.views.List = function(opts) {
var _this = this;
this.el = opts.el;
window.ionic.onGesture('swipeleft', function(e) {
_this._handleSwipeLeft(e);
}, this.el);
window.ionic.onGesture('swiperight', function(e) {
_this._handleSwipeRight(e);
}, this.el);
};
ionic.views.List.prototype = {
_handleSwipeLeft: function(e) {
var item = e.target;
if(!item.classList.contains('list-item')) {
return;
}
item.classList.add('slide-left');
},
_handleSwipeRight: function(e) {
var item = e.target;
if(!item.classList.contains('list-item')) {
return;
}
item.classList.remove('slide-left');
}
};
})(ionic);
;
(function(ionic) {