@@ -508,36 +508,25 @@ export default {
508508 // if (amount) translation += (this.touch.goNext ? 1 : 0) - dragPercentage
509509 // translation = - dragAmountPercentage
510510
511+ // If multiple visible slides and sliding one by one.
511512 if (this .conf .visibleSlides ) {
512513 translation /= this .conf .visibleSlides
513514
514- let isMiddleReached = this .slides .current >= Math .ceil (this .conf .visibleSlides / 2 ) // - 1
515- let slidesWOTranslation = Math .ceil (this .conf .visibleSlides / 2 ) - 1
516- let substractFromTranslation = Math .min (slidesWOTranslation, this .slides .current )
517- let remainingSlides = (this .slides .count - 1 ) - this .slides .current
518-
519- // If not inifinite sliding
515+ // If not inifinite sliding.
520516 if (! this .conf .infinite ) {
521- console .log ({
522- currentSlide: this .slides .current ,
523- visibleSlides: this .conf .visibleSlides ,
524- slideMultiple: this .conf .slideMultiple ,
525- // The most middle slide among visible slides.
526- preferedPosition: Math .ceil (this .conf .visibleSlides / 2 ),
527- isMiddleReached: isMiddleReached,
528- slidesWOTranslation: slidesWOTranslation,
529- slidesWOTranslationPercent: slidesWOTranslation * 100 / this .conf .visibleSlides ,
530- currTranslation: translation,
531- substractFromTranslation: substractFromTranslation,
532- remainingSlides: remainingSlides,
533- isEnd: remainingSlides <= slidesWOTranslation
534- })
535-
536- if (remainingSlides <= slidesWOTranslation) {
537- substractFromTranslation += slidesWOTranslation - remainingSlides + 1
517+ let preferedPosition = Math .ceil (this .conf .visibleSlides / 2 )
518+ let remainingSlides = this .slides .count - (this .slides .current + 1 )
519+ let positionsAfterPrefered = this .conf .visibleSlides - preferedPosition
520+ let preferedPositionIsPassed = remainingSlides < positionsAfterPrefered
521+
522+ let slidesWOTranslation = preferedPosition - 1
523+ let substractFromTranslation = Math .min (slidesWOTranslation, this .slides .current )
524+
525+ // After middle is reached.
526+ if (preferedPositionIsPassed) {
527+ substractFromTranslation += positionsAfterPrefered - remainingSlides
538528 }
539- // if (!isMiddleReached) preventUpdate = true
540- // else translation += slidesWOTranslation * 100 / this.conf.visibleSlides
529+
541530 translation += substractFromTranslation * 100 / this .conf .visibleSlides
542531 }
543532 }
0 commit comments