Skip to content

Commit

Permalink
V0.16.0 (#331)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
quinnlangille authored Nov 29, 2018
1 parent d8eed6a commit 401278a
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ jspm_packages/

# vuepress build output
.vuepress/dist

# npm package lock file
./package-lock.json
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export default {
| speed | Number | 500 | Slide transition speed. Number of milliseconds accepted. |
| value | Number | | Support for v-model functionality. Setting this value will change the current page to the number inputted (if between 0 and pageCount). |


### Events
| Event | Type | Emitter | Description |
|:--------------------------|:--------|:---------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand Down
4 changes: 2 additions & 2 deletions dist/vue-carousel.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/db.json

Large diffs are not rendered by default.

102 changes: 84 additions & 18 deletions docs/public/api/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/public/js/vue-carousel.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/themes/vue/source/js/vue-carousel.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-carousel",
"version": "0.15.0",
"version": "0.16.0-rc2",
"description": "A flexible, responsive, touch-friendly carousel for Vue.js",
"main": "dist/vue-carousel.min.js",
"scripts": {
Expand Down
22 changes: 19 additions & 3 deletions src/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ export default {
type: Boolean,
default: true
},
/*
* Flag to toggle touch dragging
*/
touchDrag: {
type: Boolean,
default: true
},
/**
* Listen for an external navigation request using this prop.
*/
Expand Down Expand Up @@ -418,7 +425,7 @@ export default {
pageCount() {
return this.scrollPerPage
? Math.ceil(this.slideCount / this.currentPerPage)
: this.slideCount - 2;
: this.slideCount - this.currentPerPage + 1;
},
/**
* Calculate the width of each slide
Expand Down Expand Up @@ -763,7 +770,16 @@ export default {
const width = this.scrollPerPage
? this.slideWidth * this.currentPerPage
: this.slideWidth;
this.offset = width * Math.round(this.offset / width);
// lock offset to either the nearest page, or to the last slide
const lastFullPageOffset = width * Math.floor(this.slideCount / this.currentPerPage - 1)
const remainderOffset = lastFullPageOffset + this.slideWidth * (this.slideCount % this.currentPerPage)
if (this.offset > (lastFullPageOffset + remainderOffset) / 2) {
this.offset = remainderOffset
}
else {
this.offset = width * Math.round(this.offset / width);
}
// clamp the offset between 0 -> maxOffset
this.offset = Math.max(0, Math.min(this.offset, this.maxOffset));
Expand Down Expand Up @@ -812,7 +828,7 @@ export default {
);
// setup the start event only if touch device or mousedrag activated
if (this.isTouch || this.mouseDrag) {
if ((this.isTouch && this.touchDrag) || this.mouseDrag) {
this.$refs["VueCarousel-wrapper"].addEventListener(
this.isTouch ? "touchstart" : "mousedown",
this.onStart
Expand Down
4 changes: 2 additions & 2 deletions src/Pagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export default {
paginationCount() {
return this.carousel && this.carousel.scrollPerPage
? this.carousel.pageCount
: this.carousel.slideCount
? this.carousel.slideCount - 2
: this.carousel.slideCount && this.carousel.currentPerPage
? this.carousel.slideCount - this.carousel.currentPerPage + 1
: 0;
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/Slide.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default {
this.carousel.minSwipeDistance === 0 ||
Math.abs(deltaX) < this.carousel.minSwipeDistance
) {
this.$emit("slideClick", Object.assign({}, e.currentTarget.dataset));
this.$emit("slideclick", Object.assign({}, e.currentTarget.dataset));
}
}
}
Expand All @@ -104,6 +104,7 @@ export default {
user-select: none;
backface-visibility: hidden;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
outline: none;
}
Expand Down
4 changes: 4 additions & 0 deletions tests/client/components/__snapshots__/carousel.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ exports[`Carousel should decrease current slide number by 1 when advance slide b
button.VueCarousel-dot-button(type='button', role='button', aria-label='\`Item \${index}\`', title='Item 0', tabindex='0', style='width: 10px; height: 10px; background: rgb(239, 239, 239);')
li.VueCarousel-dot.VueCarousel-dot--active(aria-hidden='false', role='presentation', aria-selected='true', style='margin-top: 20px; padding: 10px;')
button.VueCarousel-dot-button(type='button', role='button', aria-label='\`Item \${index}\`', title='Item 1', tabindex='0', style='width: 10px; height: 10px; background: rgb(0, 0, 0);')
li.VueCarousel-dot(aria-hidden='false', role='presentation', aria-selected='false', style='margin-top: 20px; padding: 10px;')
button.VueCarousel-dot-button(type='button', role='button', aria-label='\`Item \${index}\`', title='Item 2', tabindex='0', style='width: 10px; height: 10px; background: rgb(239, 239, 239);')
li.VueCarousel-dot(aria-hidden='false', role='presentation', aria-selected='false', style='margin-top: 20px; padding: 10px;')
button.VueCarousel-dot-button(type='button', role='button', aria-label='\`Item \${index}\`', title='Item 3', tabindex='0', style='width: 10px; height: 10px; background: rgb(239, 239, 239);')
//
"
`;
Expand Down

0 comments on commit 401278a

Please sign in to comment.