Skip to content
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

Merged
merged 6 commits into from
Dec 25, 2024

Conversation

ismail9k
Copy link
Owner

Implements #445

@ismail9k ismail9k linked an issue Dec 24, 2024 that may be closed by this pull request
@ismail9k ismail9k merged commit 762a1c9 into master Dec 25, 2024
5 checks passed
@ismail9k ismail9k deleted the 445-configurable-cloned-items-for-wrap-around branch December 25, 2024 10:44
const before = Math.min(slidesToClone, activeSlideIndex.value)
const after = Math.min(
slidesToClone,
slidesCount.value - activeSlideIndex.value - 1
Copy link
Contributor

@Tofandel Tofandel Dec 25, 2024

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,

Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable Cloned Items for Wrap-Around
2 participants