@@ -391,21 +391,9 @@ export const Carousel = defineComponent({
391
391
const currentX = 'touches' in event ? event . touches [ 0 ] . clientX : event . clientX
392
392
const currentY = 'touches' in event ? event . touches [ 0 ] . clientY : event . clientY
393
393
394
- const tmpDraggedX = currentX - startPosition . x
395
- const tmpDraggedY = currentY - startPosition . y
396
-
397
- if ( ! config . wrapAround && config . preventExcessiveDragging ) {
398
- const isAtMinIndex = activeSlideIndex . value === minSlideIndex . value ;
399
- const isAtMaxIndex = activeSlideIndex . value === maxSlideIndex . value ;
400
-
401
- if ( ( Math . abs ( tmpDraggedX ) > Math . abs ( tmpDraggedY ) ?
402
- ( tmpDraggedX > 0 && isAtMinIndex ) || ( tmpDraggedX < 0 && isAtMaxIndex ) :
403
- ( tmpDraggedY > 0 && isAtMinIndex ) || ( tmpDraggedY < 0 && isAtMaxIndex ) ) ) return ;
404
- }
405
-
406
394
// Calculate deltas for X and Y axes
407
- dragged . x = tmpDraggedX
408
- dragged . y = tmpDraggedY
395
+ dragged . x = currentX - startPosition . x
396
+ dragged . y = currentY - startPosition . y
409
397
410
398
const draggedSlides = getDraggedSlidesCount ( {
411
399
isVertical : isVertical . value ,
@@ -701,7 +689,18 @@ export const Carousel = defineComponent({
701
689
// Include user drag interaction offset
702
690
const dragOffset = isVertical . value ? dragged . y : dragged . x
703
691
704
- const totalOffset = scrolledOffset + dragOffset
692
+ let totalOffset = scrolledOffset + dragOffset
693
+
694
+ if ( ! config . wrapAround && config . preventExcessiveDragging ) {
695
+ const maxSlidingValue =
696
+ ( slidesCount . value - config . itemsToShow ) * effectiveSlideSize . value
697
+
698
+ totalOffset = getNumberInRange ( {
699
+ val : totalOffset ,
700
+ min : - 1 * maxSlidingValue ,
701
+ max : 0 ,
702
+ } )
703
+ }
705
704
706
705
return `translate${ translateAxis } (${ totalOffset } px)`
707
706
} )
0 commit comments