* @param {Carousel} carousel * @param {"prev" | "next"} direction * @param {boolean} smooth
(carousel, direction, smooth, clamped = false)
| 131 | * @param {boolean} smooth |
| 132 | */ |
| 133 | function slideDirection(carousel, direction, smooth, clamped = false) { |
| 134 | const directionIndexOffset = { prev: -1, next: 1 }[direction]; |
| 135 | const offsetDotIndex = currentClosestImageIndex(carousel) + directionIndexOffset; |
| 136 | |
| 137 | const nextDotIndex = (offsetDotIndex + carousel.dots.length) % carousel.dots.length; |
| 138 | const unwrappedNextDotIndex = clamp(offsetDotIndex, 0, carousel.dots.length - 1); |
| 139 | |
| 140 | if (clamped) slideTo(carousel, unwrappedNextDotIndex, smooth); |
| 141 | else slideTo(carousel, nextDotIndex, smooth); |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * @param {Carousel} carousel |
no test coverage detected