fix(slides): Update swiperOptions default to match version 4 of Swiper (#15578)

This commit is contained in:
Paul Stelzer
2018-09-13 19:26:12 +02:00
committed by Manu MA
parent 49ab065be7
commit db35af21f2

View File

@ -106,7 +106,7 @@ export class Slides {
* Options to pass to the swiper instance. * Options to pass to the swiper instance.
* See http://idangero.us/swiper/api/ for valid options * See http://idangero.us/swiper/api/ for valid options
*/ */
@Prop() options: any; // SwiperOptions; // TODO @Prop() options: any = {}; // SwiperOptions; // TODO
@Watch('options') @Watch('options')
updateSwiperOptions() { updateSwiperOptions() {
@ -258,25 +258,26 @@ export class Slides {
private normalizeOptions() { private normalizeOptions() {
// Base options, can be changed // Base options, can be changed
// TODO Add interface SwiperOptions
const swiperOptions = { const swiperOptions = {
effect: 'slide', effect: 'slide',
direction: 'horizontal', direction: 'horizontal',
initialSlide: 0, initialSlide: 0,
loop: false, loop: false,
pager: false,
pagination: { pagination: {
el: '.swiper-pagination', el: '.swiper-pagination',
type: 'bullets', type: 'bullets',
clickable: false,
hideOnClick: false,
}, },
parallax: false, parallax: false,
scrollbar: { scrollbar: {
el: this.scrollbar ? '.swiper-scrollbar' : null, el: this.scrollbar ? '.swiper-scrollbar' : undefined,
hide: true, hide: true,
}, },
slidesPerView: 1, slidesPerView: 1,
spaceBetween: 0, spaceBetween: 0,
speed: 300, speed: 300,
zoom: false,
slidesPerColumn: 1, slidesPerColumn: 1,
slidesPerColumnFill: 'column', slidesPerColumnFill: 'column',
slidesPerGroup: 1, slidesPerGroup: 1,
@ -284,8 +285,10 @@ export class Slides {
slidesOffsetBefore: 0, slidesOffsetBefore: 0,
slidesOffsetAfter: 0, slidesOffsetAfter: 0,
touchEventsTarget: 'container', touchEventsTarget: 'container',
autoplayDisableOnInteraction: true, autoplay: {
autoplayStopOnLast: false, disableOnInteraction: true,
stopOnLastSlide: false,
},
freeMode: false, freeMode: false,
freeModeMomentum: true, freeModeMomentum: true,
freeModeMomentumRatio: 1, freeModeMomentumRatio: 1,
@ -296,9 +299,11 @@ export class Slides {
freeModeMinimumVelocity: 0.02, freeModeMinimumVelocity: 0.02,
autoHeight: false, autoHeight: false,
setWrapperSize: false, setWrapperSize: false,
zoomMax: 3, zoom: {
zoomMin: 1, maxRatio: 3,
zoomToggle: true, minRatio: 1,
toggle: true,
},
touchRatio: 1, touchRatio: 1,
touchAngle: 45, touchAngle: 45,
simulateTouch: true, simulateTouch: true,
@ -307,14 +312,11 @@ export class Slides {
longSwipesRatio: 0.5, longSwipesRatio: 0.5,
longSwipesMs: 300, longSwipesMs: 300,
followFinger: true, followFinger: true,
onlyExternal: false,
threshold: 0, threshold: 0,
touchMoveStopPropagation: true, touchMoveStopPropagation: true,
touchReleaseOnEdges: false, touchReleaseOnEdges: false,
iOSEdgeSwipeDetection: false, iOSEdgeSwipeDetection: false,
iOSEdgeSwipeThreshold: 20, iOSEdgeSwipeThreshold: 20,
paginationClickable: false,
paginationHide: false,
resistance: true, resistance: true,
resistanceRatio: 0.85, resistanceRatio: 0.85,
watchSlidesProgress: false, watchSlidesProgress: false,
@ -325,32 +327,37 @@ export class Slides {
loopAdditionalSlides: 0, loopAdditionalSlides: 0,
noSwiping: true, noSwiping: true,
runCallbacksOnInit: true, runCallbacksOnInit: true,
controlBy: 'slide', controller: {
controlInverse: false, control: this.swiper,
coverflow: { by: 'slide',
inverse: false,
},
coverflowEffect: {
rotate: 50, rotate: 50,
stretch: 0, stretch: 0,
depth: 100, depth: 100,
modifier: 1, modifier: 1,
slideShadows: true slideShadows: true
}, },
flip: { flipEffect: {
slideShadows: true, slideShadows: true,
limitRotation: true limitRotation: true
}, },
cube: { cubeEffect: {
slideShadows: true, slideShadows: true,
shadow: true, shadow: true,
shadowOffset: 20, shadowOffset: 20,
shadowScale: 0.94 shadowScale: 0.94
}, },
fade: { fadeEffect: {
crossFade: false crossFade: false
}, },
prevSlideMessage: 'Previous slide', a11y: {
nextSlideMessage: 'Next slide', prevSlideMessage: 'Previous slide',
firstSlideMessage: 'This is the first slide', nextSlideMessage: 'Next slide',
lastSlideMessage: 'This is the last slide' firstSlideMessage: 'This is the first slide',
lastSlideMessage: 'This is the last slide'
}
}; };
// Keep the event options separate, we dont want users // Keep the event options separate, we dont want users