|
@@ -30,6 +30,7 @@ function DragableElm(elm) { |
|
@@ -30,6 +30,7 @@ function DragableElm(elm) { |
30
|
let _endY = 0;
|
30
|
let _endY = 0;
|
31
|
let _open = false;
|
31
|
let _open = false;
|
32
|
let _startTime = 0;
|
32
|
let _startTime = 0;
|
|
|
33
|
+ let _canDrag = true;
|
33
|
|
34
|
|
34
|
const moveElm = (y) => {
|
35
|
const moveElm = (y) => {
|
35
|
_moveY = Math.min(Math.max(y, _maxY), 0);
|
36
|
_moveY = Math.min(Math.max(y, _maxY), 0);
|
|
@@ -52,16 +53,32 @@ function DragableElm(elm) { |
|
@@ -52,16 +53,32 @@ function DragableElm(elm) { |
52
|
});
|
53
|
});
|
53
|
};
|
54
|
};
|
54
|
|
55
|
|
|
|
56
|
+ elm.find('.detail-container').scroll(e => {
|
|
|
57
|
+ _canDrag = !!(_open && e.target.scrollTop < 10);
|
|
|
58
|
+ });
|
|
|
59
|
+
|
55
|
elm.on('touchstart', e => {
|
60
|
elm.on('touchstart', e => {
|
|
|
61
|
+ if (!_canDrag && open) {
|
|
|
62
|
+ return;
|
|
|
63
|
+ }
|
|
|
64
|
+
|
56
|
let point = get(e, 'originalEvent.targetTouches[0]') || {};
|
65
|
let point = get(e, 'originalEvent.targetTouches[0]') || {};
|
57
|
|
66
|
|
58
|
_startY = point.pageY;
|
67
|
_startY = point.pageY;
|
59
|
_startTime = new Date();
|
68
|
_startTime = new Date();
|
60
|
}).on('touchmove', e => {
|
69
|
}).on('touchmove', e => {
|
|
|
70
|
+ if (!_startTime) {
|
|
|
71
|
+ return;
|
|
|
72
|
+ }
|
|
|
73
|
+
|
61
|
let point = get(e, 'originalEvent.targetTouches[0]') || {};
|
74
|
let point = get(e, 'originalEvent.targetTouches[0]') || {};
|
62
|
|
75
|
|
63
|
moveElm(point.pageY - _startY + _endY);
|
76
|
moveElm(point.pageY - _startY + _endY);
|
64
|
}).on('touchend', e => {
|
77
|
}).on('touchend', e => {
|
|
|
78
|
+ if (!_startTime) {
|
|
|
79
|
+ return;
|
|
|
80
|
+ }
|
|
|
81
|
+
|
65
|
let time = new Date() - _startTime;
|
82
|
let time = new Date() - _startTime;
|
66
|
let movedY = Math.abs(_moveY - _endY);
|
83
|
let movedY = Math.abs(_moveY - _endY);
|
67
|
let moveOption = {};
|
84
|
let moveOption = {};
|
|
@@ -92,6 +109,7 @@ function DragableElm(elm) { |
|
@@ -92,6 +109,7 @@ function DragableElm(elm) { |
92
|
_open = !_open;
|
109
|
_open = !_open;
|
93
|
}
|
110
|
}
|
94
|
}, moveOption.time);
|
111
|
}, moveOption.time);
|
|
|
112
|
+ _startTime = 0;
|
95
|
});
|
113
|
});
|
96
|
}
|
114
|
}
|
97
|
|
115
|
|