From 41d85f7a0a65ef9897f5d7540b06bab44b3cfa87 Mon Sep 17 00:00:00 2001 From: Jamie Sutherland Date: Sat, 15 Nov 2014 20:24:19 +0000 Subject: [PATCH] fix(SlideDrag) clears drag when list is scrolled or new drag starts This also fixes the broken $ionicListDelegate.clearOptionButtons() method. Makes lists feel more natural inline with iOS functionality and fixes issues with using ion-option-buttons with collection repeat --- js/views/listView.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/views/listView.js b/js/views/listView.js index 1477345a30..2de0ad3bee 100644 --- a/js/views/listView.js +++ b/js/views/listView.js @@ -170,11 +170,10 @@ // Kill the current drag - if (_this._lastDrag) { - _this._lastDrag.buttons = null; - _this._lastDrag.content = null; + if (!_this._lastDrag) { + _this._lastDrag = {}; } - _this._lastDrag = _this._currentDrag; + angular.extend(_this._lastDrag, _this._currentDrag); if (_this._currentDrag) { _this._currentDrag.buttons = null; _this._currentDrag.content = null; @@ -517,6 +516,11 @@ var lastDragOp = this._lastDragOp; var item; + // If we have an open SlideDrag and we're scrolling the list. Clear it. + if (this._didDragUpOrDown && lastDragOp instanceof SlideDrag) { + lastDragOp.clean && lastDragOp.clean(); + } + // Check if this is a reorder drag if (ionic.DomUtil.getParentOrSelfWithClass(e.target, ITEM_REORDER_BTN_CLASS) && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) { item = this._getItem(e.target);