-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
445 configurable cloned items for wrap around #462
445 configurable cloned items for wrap around #462
Conversation
…te cloned slides as needed
const before = Math.min(slidesToClone, activeSlideIndex.value) | ||
const after = Math.min( | ||
slidesToClone, | ||
slidesCount.value - activeSlideIndex.value - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This calculation for while dragging does not seem correct, if you have 10 slides and are on slide 9 (the last slide), you get after = 0 and it should be the other way around, when you arrive close to the end it should start from 0 and start increasing (it should also include the offset)
I think it should look something more like activeSlideIndex.value + ceil((offset + itemsToShow) / 2) - slidesCount,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing this out. Indeed, the equation should have been:
slidesToClone - (slidesCount.value - activeSlideIndex.value - 1)
Let’s consider an example where slidesToClone = 2 and slidesCount = 10. Below is the calculation for different values of activeSlideIndex ranging from 8 to 11:
activeSlideIndex | Calculation | Result |
---|---|---|
8 | 2 - (10 - 8 - 1) = 2 - (1) | 1 |
9 | 2 - (10 - 9 - 1) = 2 - (0) | 2 |
10 | 2 - (10 - 10 - 1) = 2 - (-1) | 3 |
11 | 2 - (10 - 11 - 1) = 2 - (-2) | 4 |
Implements #445