fix: navigate back from last page #79
Open
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.
This is a fix to improve over customized sliders with different styles than the used here by default.
Essentially the problem here was that by just having an
epsilon
kind ofdelta
value of5
(px) to check where page are we in based on the scroll position was not something reliable for custom cases where we wanna have custom spacing or different sliders widths.So the fix is rather simple, instead of having a 5px
epsilon
value, we use the half of the slide width to check where we really are on the slider, doing this we don't even need to check theoffset
position of the slider to see if we are on the last page and force the page to be the last one (which again, is not reliable because you end up putting the user on a page he is not really at)You can see a sample of this working here: https://codesandbox.io/s/vue-snap-xus1hx?file=/src/components/Carousel/Carousel.vue:5458-5742