Fix carousel failing to lock to remainder slides #303
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix locking issue #243
Description
Previously, the carousel would calculate offset and lock it to an exact multiple of
slideWidth * currentPerPage
.For example, say we had 7 slides with 3 per page with 1 extra slide, it would only lock to display slides 1 - 3, 4 - 6, and when on 5 - 7 and the screen was tapped, it would revert to 4 - 6 due to improper offset handling.
This was solved by ensuring that the remainder slides (5 - 7 in this example) is a valid position for the carousel to lock into.
Motivation and Context
It solves #243
To replicate the bug fix, add an extra slide to the Vue Play examples (so it doesn't divide evenly by currentPerPage). Now, tapping on the final slide when the carousel is all the way over will not cause it to lock back to the previous page. Whereas previously, as per the issue solved here, that would occur.
How Has This Been Tested?
Vue Play was used to test the behaviour of the component.
Screenshots (if appropriate):
N/A
Types of changes
Checklist:
Credit also to @noahlafferty