|
@ -18,6 +18,7 @@ require(["ipuUI", "jquery", "tool", "PanCarousel", 'Hammer'], function (ipuUI, $
|
18
|
18
|
var outid;
|
19
|
19
|
var dragLiIndex; // 拖拽的对象的初始泳道
|
20
|
20
|
var lastX = 0; // 记录切换泳道时的X坐标
|
|
21
|
var titleHeight = null; //
|
21
|
22
|
|
22
|
23
|
listenEl.addEventListener("touchstart", touchStartLister, {passive: true}); // 添加触屏监听
|
23
|
24
|
|
|
@ -37,6 +38,8 @@ require(["ipuUI", "jquery", "tool", "PanCarousel", 'Hammer'], function (ipuUI, $
|
37
|
38
|
return;
|
38
|
39
|
}
|
39
|
40
|
|
|
41
|
titleHeight = $(".project-phase-item .item-state:first").outerHeight();
|
|
42
|
|
40
|
43
|
if (isDragSlt) { // 当前即为dragItem
|
41
|
44
|
dragItem = $(e.target);
|
42
|
45
|
} else {
|
|
@ -54,7 +57,8 @@ require(["ipuUI", "jquery", "tool", "PanCarousel", 'Hammer'], function (ipuUI, $
|
54
|
57
|
if (touchState == 1) { // 1秒后,还没有移动
|
55
|
58
|
touchState = 2; // 满足条件可拖动
|
56
|
59
|
dragPosition = dragItem.position(); // 相当父元素偏移
|
57
|
|
dragPosition.top = dragItem.offset().top - dragItem.parents("li").offset().top; // top值要进行处理
|
|
60
|
// dragPosition.top = dragItem.offset().top - dragItem.parents("li").offset().top;
|
|
61
|
dragPosition.top = dragPosition.top + titleHeight; // top值要进行处理,默认相对的div class ipu-flex-col,要加上标题高度
|
58
|
62
|
placeholderEl = $(placeholderHtml).insertBefore(dragItem);
|
59
|
63
|
placeholderEl.height(dragItem.height());
|
60
|
64
|
dragLiIndex = carousel.currentIndex;
|
|
@ -108,15 +112,21 @@ require(["ipuUI", "jquery", "tool", "PanCarousel", 'Hammer'], function (ipuUI, $
|
108
|
112
|
disabledMove++;
|
109
|
113
|
index = index + (moveX > 0 ? 1 : -1); // 判断是向左还是往右
|
110
|
114
|
carousel.show(index);
|
|
115
|
|
|
116
|
setTimeout(function () {
|
|
117
|
if (touchState == 2) { // 有可能在等待时,就touchend了
|
|
118
|
placeholderEl.appendTo($(".ipu-carousel-wrapper li:eq(" + index + ") .project-task-list")); // 默认拖动后放在对应泳道的最后位置
|
|
119
|
adjustPhd(newPosition);
|
|
120
|
}
|
|
121
|
}, 300);
|
|
122
|
|
111
|
123
|
setTimeout(function () {
|
112
|
124
|
disabledMove--;
|
113
|
125
|
lastX = 0;
|
114
|
|
// placeholderEl = placeholderEl.appendTo($(".ipu-carousel-wrapper li:eq(" + index + ") .project-task-list")); // 默认拖动后放在对应泳道的最后位置
|
115
|
|
// adjustPhd(newPosition);
|
116
|
|
}, 1600);
|
|
126
|
}, 1000);
|
117
|
127
|
}
|
118
|
128
|
} else { // 还要处理往下的滚动
|
119
|
|
// adjustPhd(newPosition);
|
|
129
|
adjustPhd(newPosition);
|
120
|
130
|
}
|
121
|
131
|
}
|
122
|
132
|
}
|
|
@ -131,7 +141,7 @@ require(["ipuUI", "jquery", "tool", "PanCarousel", 'Hammer'], function (ipuUI, $
|
131
|
141
|
|
132
|
142
|
$(".ipu-carousel-wrapper li:eq(" + index + ") .project-task-item").each(function (index, el) {
|
133
|
143
|
// 在一个子项的上半部或下半部,位置好像不大准确
|
134
|
|
var tempOffsetTop = newPosition.top - $(el).position().top;
|
|
144
|
var tempOffsetTop = newPosition.top - titleHeight - $(el).position().top;
|
135
|
145
|
if (tempOffsetTop > 0 && (index == 0 || tempOffsetTop < offsetTop)) {
|
136
|
146
|
offsetTop = tempOffsetTop;
|
137
|
147
|
toIndex = index;
|