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
This commit is contained in:
Jamie Sutherland
2014-11-15 20:24:19 +00:00
parent 05be19d3ad
commit 41d85f7a0a

View File

@@ -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);