mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Fixed dragging list items
This commit is contained in:
7
dist/js/ionic-angular.js
vendored
7
dist/js/ionic-angular.js
vendored
@ -247,14 +247,16 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
|||||||
<div class="list-item-content" ng-transclude>\
|
<div class="list-item-content" ng-transclude>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="list-item-drag" ng-if="canReorder && isEditing">\
|
<div class="list-item-drag" ng-if="canReorder && isEditing">\
|
||||||
<button ng-click="startReorder()"><i ng-class="reorderIcon"></i></button>\
|
<button class="button button-icon" ng-click="startReorder()"><i ng-class="reorderIcon"></i></button>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="list-item-buttons" ng-if="canSwipe && !isEditing">\
|
<div class="list-item-buttons" ng-if="canSwipe && !isEditing">\
|
||||||
<button ng-click="onButtonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
<button ng-click="onButtonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
||||||
</div>\
|
</div>\
|
||||||
</li>',
|
</li>',
|
||||||
link: function($scope, $element, $attr, list) {
|
link: function($scope, $element, $attr, list) {
|
||||||
|
$scope.isEditing = false;
|
||||||
$scope.deleteIcon = list.scope.deleteIcon;
|
$scope.deleteIcon = list.scope.deleteIcon;
|
||||||
|
$scope.reorderIcon = list.scope.reorderIcon;
|
||||||
|
|
||||||
list.scope.$watch('isEditing', function(v) {
|
list.scope.$watch('isEditing', function(v) {
|
||||||
$scope.isEditing = v;
|
$scope.isEditing = v;
|
||||||
@ -271,7 +273,8 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
|||||||
|
|
||||||
scope: {
|
scope: {
|
||||||
isEditing: '=',
|
isEditing: '=',
|
||||||
deleteIcon: '@'
|
deleteIcon: '@',
|
||||||
|
reorderIcon: '@'
|
||||||
},
|
},
|
||||||
|
|
||||||
// So we can require being under this
|
// So we can require being under this
|
||||||
|
|||||||
5
dist/js/ionic.js
vendored
5
dist/js/ionic.js
vendored
@ -1928,6 +1928,11 @@ window.ionic = {
|
|||||||
_this._startDrag(e);
|
_this._startDrag(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We really aren't dragging
|
||||||
|
if(!_this._currentDrag) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we should start dragging. Check if we've dragged past the threshold,
|
// Check if we should start dragging. Check if we've dragged past the threshold,
|
||||||
// or we are starting from the open state.
|
// or we are starting from the open state.
|
||||||
if(!_this._isDragging &&
|
if(!_this._isDragging &&
|
||||||
|
|||||||
7
js/ext/angular/src/directive/ionicList.js
vendored
7
js/ext/angular/src/directive/ionicList.js
vendored
@ -22,14 +22,16 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
|||||||
<div class="list-item-content" ng-transclude>\
|
<div class="list-item-content" ng-transclude>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="list-item-drag" ng-if="canReorder && isEditing">\
|
<div class="list-item-drag" ng-if="canReorder && isEditing">\
|
||||||
<button ng-click="startReorder()"><i ng-class="reorderIcon"></i></button>\
|
<button class="button button-icon" ng-click="startReorder()"><i ng-class="reorderIcon"></i></button>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class="list-item-buttons" ng-if="canSwipe && !isEditing">\
|
<div class="list-item-buttons" ng-if="canSwipe && !isEditing">\
|
||||||
<button ng-click="onButtonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
<button ng-click="onButtonClicked(button)" class="button" ng-class="button.type" ng-repeat="button in buttons">{{button.text}}</button>\
|
||||||
</div>\
|
</div>\
|
||||||
</li>',
|
</li>',
|
||||||
link: function($scope, $element, $attr, list) {
|
link: function($scope, $element, $attr, list) {
|
||||||
|
$scope.isEditing = false;
|
||||||
$scope.deleteIcon = list.scope.deleteIcon;
|
$scope.deleteIcon = list.scope.deleteIcon;
|
||||||
|
$scope.reorderIcon = list.scope.reorderIcon;
|
||||||
|
|
||||||
list.scope.$watch('isEditing', function(v) {
|
list.scope.$watch('isEditing', function(v) {
|
||||||
$scope.isEditing = v;
|
$scope.isEditing = v;
|
||||||
@ -46,7 +48,8 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
|||||||
|
|
||||||
scope: {
|
scope: {
|
||||||
isEditing: '=',
|
isEditing: '=',
|
||||||
deleteIcon: '@'
|
deleteIcon: '@',
|
||||||
|
reorderIcon: '@'
|
||||||
},
|
},
|
||||||
|
|
||||||
// So we can require being under this
|
// So we can require being under this
|
||||||
|
|||||||
@ -51,7 +51,10 @@
|
|||||||
<content has-header="true" ng-controller="TestCtrl" class="reveal-animation">
|
<content has-header="true" ng-controller="TestCtrl" class="reveal-animation">
|
||||||
<list is-editing="isEditingItems" animation="my-repeat-animation" delete-icon="icon-minus-circled" reorder-icon="icon-navicon">
|
<list is-editing="isEditingItems" animation="my-repeat-animation" delete-icon="icon-minus-circled" reorder-icon="icon-navicon">
|
||||||
<list-item ng-repeat="item in items"
|
<list-item ng-repeat="item in items"
|
||||||
|
buttons="item.buttons"
|
||||||
can-delete="true"
|
can-delete="true"
|
||||||
|
can-reorder="true"
|
||||||
|
can-swipe="true"
|
||||||
on-delete="deleteProject(project)"
|
on-delete="deleteProject(project)"
|
||||||
on-select="selectProject(project)">
|
on-select="selectProject(project)">
|
||||||
{{item.text}}
|
{{item.text}}
|
||||||
|
|||||||
@ -122,6 +122,11 @@
|
|||||||
_this._startDrag(e);
|
_this._startDrag(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We really aren't dragging
|
||||||
|
if(!_this._currentDrag) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we should start dragging. Check if we've dragged past the threshold,
|
// Check if we should start dragging. Check if we've dragged past the threshold,
|
||||||
// or we are starting from the open state.
|
// or we are starting from the open state.
|
||||||
if(!_this._isDragging &&
|
if(!_this._isDragging &&
|
||||||
|
|||||||
Reference in New Issue
Block a user