From 68433b5573fa8b6b2dfb71648ef40dea4e6973b0 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 12 Dec 2013 12:23:33 -0600 Subject: [PATCH] Fixed reordering for #319 --- dist/js/ionic-angular.js | 1 + dist/js/ionic.js | 27 ++++++++++------------- js/ext/angular/src/directive/ionicList.js | 1 + js/views/listView.js | 27 ++++++++++------------- 4 files changed, 26 insertions(+), 30 deletions(-) diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index 7390fb1e4d..f8cd0e72d2 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -1007,6 +1007,7 @@ angular.module('ionic.ui.list', ['ngAnimate']) refreshComplete: '=', onSelect: '&', onDelete: '&', + onReorder: '&', optionButtons: '&', deleteIcon: '@', reorderIcon: '@' diff --git a/dist/js/ionic.js b/dist/js/ionic.js index a5fd4984b8..2982342942 100644 --- a/dist/js/ionic.js +++ b/dist/js/ionic.js @@ -4416,9 +4416,12 @@ ionic.views.Scroll = ionic.views.View.inherit({ }, this.el); window.ionic.onGesture('release', function(e) { - _this._handleTouchRelease(e); + _this._handleEndDrag(e); }, this.el); + window.ionic.onGesture('drag', function(e) { + _this._handleDrag(e); + }, this.el); // Start the drag states this._initDrag(); }, @@ -4551,6 +4554,13 @@ ionic.views.Scroll = ionic.views.View.inherit({ return; } + // Cancel touch timeout + clearTimeout(this._touchTimeout); + var items = _this.el.querySelectorAll('.item'); + for(var i = 0, l = items.length; i < l; i++) { + items[i].classList.remove('active'); + } + this._dragOp.end(e, function() { _this._initDrag(); }); @@ -4581,7 +4591,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ return; } - e.preventDefault(); + e.gesture.srcEvent.preventDefault(); this._dragOp.drag(e); }, @@ -4603,19 +4613,6 @@ ionic.views.Scroll = ionic.views.View.inherit({ }, 250); }, - /** - * Handle the release event to remove the active state on an item if necessary. - */ - _handleTouchRelease: function(e) { - var _this = this; - - // Cancel touch timeout - clearTimeout(this._touchTimeout); - var items = _this.el.querySelectorAll('.item'); - for(var i = 0, l = items.length; i < l; i++) { - items[i].classList.remove('active'); - } - } }); })(ionic); diff --git a/js/ext/angular/src/directive/ionicList.js b/js/ext/angular/src/directive/ionicList.js index efabb83cd8..31ebccf6ad 100644 --- a/js/ext/angular/src/directive/ionicList.js +++ b/js/ext/angular/src/directive/ionicList.js @@ -207,6 +207,7 @@ angular.module('ionic.ui.list', ['ngAnimate']) refreshComplete: '=', onSelect: '&', onDelete: '&', + onReorder: '&', optionButtons: '&', deleteIcon: '@', reorderIcon: '@' diff --git a/js/views/listView.js b/js/views/listView.js index 6b09c389b0..8a0962a2fc 100644 --- a/js/views/listView.js +++ b/js/views/listView.js @@ -285,9 +285,12 @@ }, this.el); window.ionic.onGesture('release', function(e) { - _this._handleTouchRelease(e); + _this._handleEndDrag(e); }, this.el); + window.ionic.onGesture('drag', function(e) { + _this._handleDrag(e); + }, this.el); // Start the drag states this._initDrag(); }, @@ -420,6 +423,13 @@ return; } + // Cancel touch timeout + clearTimeout(this._touchTimeout); + var items = _this.el.querySelectorAll('.item'); + for(var i = 0, l = items.length; i < l; i++) { + items[i].classList.remove('active'); + } + this._dragOp.end(e, function() { _this._initDrag(); }); @@ -450,7 +460,7 @@ return; } - e.preventDefault(); + e.gesture.srcEvent.preventDefault(); this._dragOp.drag(e); }, @@ -472,19 +482,6 @@ }, 250); }, - /** - * Handle the release event to remove the active state on an item if necessary. - */ - _handleTouchRelease: function(e) { - var _this = this; - - // Cancel touch timeout - clearTimeout(this._touchTimeout); - var items = _this.el.querySelectorAll('.item'); - for(var i = 0, l = items.length; i < l; i++) { - items[i].classList.remove('active'); - } - } }); })(ionic);