Skip to content

Commit f086824

Browse files
committed
refactor: rename variable scrolledOffset to output for clarity in Carousel component
1 parent 6e3c47f commit f086824

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/components/Carousel/Carousel.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ export const Carousel = defineComponent({
694694
})
695695

696696
const scrolledOffset = computed(() => {
697-
let scrolledOffset = 0
697+
let output = 0
698698

699699
if (isAuto.value) {
700700
const slideIndex =
@@ -706,16 +706,16 @@ export const Carousel = defineComponent({
706706
})
707707

708708
if (currentSlideIndex.value < 0) {
709-
scrolledOffset =
709+
output =
710710
slidesRect.value
711711
.slice(currentSlideIndex.value)
712712
.reduce((acc, slide) => acc + slide[dimension.value] + config.gap, 0) * -1
713713
} else {
714-
scrolledOffset = slidesRect.value
714+
output = slidesRect.value
715715
.slice(0, currentSlideIndex.value)
716716
.reduce((acc, slide) => acc + slide[dimension.value] + config.gap, 0)
717717
}
718-
scrolledOffset -= snapAlignOffset
718+
output -= snapAlignOffset
719719

720720
// remove whitespace
721721
if (!config.wrapAround) {
@@ -727,8 +727,8 @@ export const Carousel = defineComponent({
727727
viewportRect.value[dimension.value] -
728728
config.gap
729729

730-
scrolledOffset = getNumberInRange({
731-
val: scrolledOffset,
730+
output = getNumberInRange({
731+
val: output,
732732
max: maxSlidingValue,
733733
min: 0,
734734
})
@@ -748,10 +748,10 @@ export const Carousel = defineComponent({
748748
min: 0,
749749
})
750750
}
751-
scrolledOffset = scrolledSlides * effectiveSlideSize.value
751+
output = scrolledSlides * effectiveSlideSize.value
752752
}
753753

754-
return scrolledOffset * (isReversed.value ? 1 : -1)
754+
return output * (isReversed.value ? 1 : -1)
755755
})
756756

757757
const trackTransform: ComputedRef<string | undefined> = computed(() => {

0 commit comments

Comments
 (0)