Skip to content

Commit

Permalink
fix(ionList): allow scrolling while reorder or delete is active
Browse files Browse the repository at this point in the history
Closes #1703
  • Loading branch information
ajoslin committed Jul 7, 2014
1 parent e3db085 commit 2e9d096
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion js/angular/directive/itemDeleteButton.js
@@ -1,5 +1,5 @@
var ITEM_TPL_DELETE_BUTTON =
'<div class="item-left-edit item-delete ng-hide">' +
'<div class="item-left-edit item-delete ng-hide enable-pointer-events">' +
'</div>';
/**
* @ngdoc directive
Expand Down
2 changes: 1 addition & 1 deletion js/angular/directive/itemReorderButton.js
@@ -1,5 +1,5 @@
var ITEM_TPL_REORDER_BUTTON =
'<div data-prevent-scroll="true" class="item-right-edit item-reorder ng-hide">' +
'<div data-prevent-scroll="true" class="item-right-edit item-reorder ng-hide enable-pointer-events">' +
'</div>';

/**
Expand Down
26 changes: 12 additions & 14 deletions js/angular/directive/list.js
Expand Up @@ -140,9 +140,12 @@ function($animate, $timeout) {
if (isShown) listCtrl.closeOptionButtons();
listCtrl.canSwipeItems(!isShown);

var deleteButton = jqLite($element[0].getElementsByClassName('item-delete'));

$element.children().toggleClass('list-left-editing', isShown);
toggleNgHide('.item-delete.item-left-edit', isShown);
toggleTapDisabled('.item-content', isShown);
toggleNgHide(deleteButton, isShown);

$element.toggleClass('disable-pointer-events', isShown);
});
$scope.$watch(function() {
return listCtrl.showReorder();
Expand All @@ -153,28 +156,23 @@ function($animate, $timeout) {
if (isShown) listCtrl.closeOptionButtons();
listCtrl.canSwipeItems(!isShown);

var reorderButton = jqLite($element[0].getElementsByClassName('item-reorder'));

$element.children().toggleClass('list-right-editing', isShown);
toggleNgHide('.item-reorder.item-right-edit', isShown);
toggleTapDisabled('.item-content', isShown);
toggleNgHide(reorderButton, isShown);

$element.toggleClass('disable-pointer-events', isShown);
});

function toggleNgHide(selector, shouldShow) {
forEach($element[0].querySelectorAll(selector), function(node) {
function toggleNgHide(element, shouldShow) {
forEach(element, function(node) {
if (shouldShow) {
$animate.removeClass(jqLite(node), 'ng-hide');
} else {
$animate.addClass(jqLite(node), 'ng-hide');
}
});
}
function toggleTapDisabled(selector, shouldDisable) {
var el = jqLite($element[0].querySelectorAll(selector));
if (shouldDisable) {
el.attr('data-tap-disabled', 'true');
} else {
el.removeAttr('data-tap-disabled');
}
}
}

};
Expand Down

0 comments on commit 2e9d096

Please sign in to comment.