pixuireactcomponents 1.5.34 → 1.5.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -167,6 +167,8 @@ export function Carousel(props) {
|
|
|
167
167
|
};
|
|
168
168
|
}, []);
|
|
169
169
|
var handlePrev = function () {
|
|
170
|
+
if (!loop && showIndex == 1)
|
|
171
|
+
return;
|
|
170
172
|
if (isMoving.current)
|
|
171
173
|
return;
|
|
172
174
|
isMoving.current = true;
|
|
@@ -244,7 +246,38 @@ export function Carousel(props) {
|
|
|
244
246
|
var b = rect.bottom;
|
|
245
247
|
var x = e.clientX;
|
|
246
248
|
var y = e.clientY;
|
|
247
|
-
|
|
249
|
+
//loop=false时,首尾元素不能继续往外滑动
|
|
250
|
+
if (loop == false) {
|
|
251
|
+
if (showIndex == 1) {
|
|
252
|
+
if (!isVertical) {
|
|
253
|
+
if (x - mouseDownX.current > 0) {
|
|
254
|
+
// console.log('stop x', x);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
if (y - mouseDownY.current < 0) {
|
|
260
|
+
// console.log('stop y', y);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else if (showIndex == carouselItems.length - 2) {
|
|
266
|
+
if (!isVertical) {
|
|
267
|
+
if (x - mouseDownX.current < 0) {
|
|
268
|
+
// console.log('stop x', x);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
if (y - mouseDownY.current < 0) {
|
|
274
|
+
// console.log('stop y', y);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
setGestureoffset([x - mouseDownX.current, y - mouseDownY.current]);
|
|
248
281
|
//计算滑动超出元素范围
|
|
249
282
|
if (x < l || x > r || y > b || y < t) {
|
|
250
283
|
gestureUp();
|