|
3003 | 3003 | var dragEl = _ref.dragEl;
|
3004 | 3004 | lastSwapEl = dragEl;
|
3005 | 3005 | },
|
3006 |
| - dragOverValid: function dragOverValid(_ref2) { |
| 3006 | + dragOver: function dragOver(_ref2) { |
3007 | 3007 | var completed = _ref2.completed,
|
3008 | 3008 | target = _ref2.target,
|
3009 | 3009 | onMove = _ref2.onMove,
|
3010 | 3010 | activeSortable = _ref2.activeSortable,
|
3011 | 3011 | changed = _ref2.changed,
|
3012 | 3012 | cancel = _ref2.cancel;
|
3013 | 3013 | if (!activeSortable.options.swap) return;
|
| 3014 | + |
| 3015 | + if (target && lastSwapEl && target !== lastSwapEl) { |
| 3016 | + toggleClass(lastSwapEl, this.options.swapClass, false); // If dragOverValid doesn't set this, target isn't valid |
| 3017 | + |
| 3018 | + lastSwapEl = null; |
| 3019 | + } |
| 3020 | + }, |
| 3021 | + dragOverValid: function dragOverValid(_ref3) { |
| 3022 | + var completed = _ref3.completed, |
| 3023 | + target = _ref3.target, |
| 3024 | + onMove = _ref3.onMove, |
| 3025 | + activeSortable = _ref3.activeSortable, |
| 3026 | + changed = _ref3.changed, |
| 3027 | + cancel = _ref3.cancel; |
| 3028 | + if (!activeSortable.options.swap) return; |
3014 | 3029 | var el = this.sortable.el,
|
3015 | 3030 | options = this.options;
|
3016 | 3031 |
|
3017 | 3032 | if (target && target !== el) {
|
3018 |
| - var prevSwapEl = lastSwapEl; |
3019 |
| - |
3020 | 3033 | if (onMove(target) !== false) {
|
3021 | 3034 | toggleClass(target, options.swapClass, true);
|
3022 | 3035 | lastSwapEl = target;
|
3023 |
| - } else { |
3024 |
| - lastSwapEl = null; |
3025 |
| - } |
3026 |
| - |
3027 |
| - if (prevSwapEl && prevSwapEl !== lastSwapEl) { |
3028 |
| - toggleClass(prevSwapEl, options.swapClass, false); |
3029 | 3036 | }
|
3030 | 3037 | }
|
3031 | 3038 |
|
3032 | 3039 | changed();
|
3033 | 3040 | completed(true);
|
3034 | 3041 | cancel();
|
3035 | 3042 | },
|
3036 |
| - drop: function drop(_ref3) { |
3037 |
| - var activeSortable = _ref3.activeSortable, |
3038 |
| - putSortable = _ref3.putSortable, |
3039 |
| - dragEl = _ref3.dragEl; |
| 3043 | + drop: function drop(_ref4) { |
| 3044 | + var activeSortable = _ref4.activeSortable, |
| 3045 | + putSortable = _ref4.putSortable, |
| 3046 | + dragEl = _ref4.dragEl; |
3040 | 3047 | var toSortable = putSortable || this.sortable;
|
3041 | 3048 | var options = this.options;
|
3042 | 3049 | lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);
|
|
0 commit comments