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

Fix carousel failing to lock to remainder slides #303

Merged
merged 4 commits into from
Oct 31, 2018

Conversation

saschwartz
Copy link

@saschwartz saschwartz commented Oct 26, 2018

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I have included a vue-play example (if this is a new feature)

Credit also to @noahlafferty

fix carousel bug
@saschwartz saschwartz changed the title Update Carousel.vue Fix carousel failing to lock to remainder slides Oct 26, 2018
@saschwartz
Copy link
Author

Hi @quinnlangille, I notice that you maintain this repo - any chance you might be able to take a look at this PR?

I see that you have opened #274 for discussing a refactor of the logic entirely - seems great. Though, since our team uses this component in production it'd be wonderful to merge in this fix even in advance of that if you are open to that.

@quinnlangille
Copy link
Member

Lgtm! Thanks for the fix, it was a serious issue. I’ll leave the current issue open, as a full rewrite of the logic is definitely needed but this is a great patch in the mean time!

@quinnlangille quinnlangille changed the base branch from master to v0.16.0 October 31, 2018 22:33
@quinnlangille quinnlangille merged commit b6c6775 into SSENSE:v0.16.0 Oct 31, 2018
@quinnlangille
Copy link
Member

Regarding your email, I’ve merged this into the current working branch and will release as an rc as soon as possible!

@saschwartz
Copy link
Author

Unreal thanks!

quinnlangille pushed a commit that referenced this pull request Nov 26, 2018
* Update Carousel.vue

fix carousel bug

* Added a looping autoplay to the Story page. (#305)

* docs(readme): updated README configuration section (#304)
quinnlangille added a commit that referenced this pull request Nov 29, 2018
* feat(standard): adding touchDrag prop to block touch dragging (#296)

* feat(standard): adding touchDrag prop to block dragging on mobile devices

* feat(standard): adding touchDrag prop to block dragging on mobile devices - removing package-lock.json

* adding line-break space to end of file

* chore(build): release for rc1

* v0.16.0-rc1

* Fix carousel failing to lock to remainder slides (#303)

* Update Carousel.vue

fix carousel bug

* Added a looping autoplay to the Story page. (#305)

* docs(readme): updated README configuration section (#304)

* v0.16.0-rc2

* fix: rename event slideClick to slideclick in Slide.vue (#311)

* fix: rename event slideClick to slideclick

* fix(slide): disable tap highlight in Mobile Safari (#326)

* fix(slide): disable tap highlight in Mobile Safari

* feat: add correct calculation for pageCount (#329)

* chore: build
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.

5 participants