From e3c60c5de4dd647c477135a6420ade0e16f08e5c Mon Sep 17 00:00:00 2001 From: Jody Brewster Date: Mon, 5 Jun 2017 12:12:25 -0400 Subject: [PATCH] feat(slides): support centering slides and using decimal numbers Closes #10361 --- src/components/slides/slides.ts | 18 +++++++++++++----- src/components/slides/test/options/main.html | 3 ++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/slides/slides.ts b/src/components/slides/slides.ts index a427f6c823..5b8f35de51 100644 --- a/src/components/slides/slides.ts +++ b/src/components/slides/slides.ts @@ -365,10 +365,22 @@ export class Slides extends Ion { return this._slidesPerView; } set slidesPerView(val: any) { - this._slidesPerView = val === 'auto' ? 'auto' : parseInt(val, 10); + this._slidesPerView = val === 'auto' ? 'auto' : parseFloat(val); } private _slidesPerView: number|string = 1; + /** + * @input {boolean} Center a slide in the middle of the screen. + */ + @Input() + get centeredSlides() { + return this._centeredSlides; + } + set centeredSlides(val: boolean) { + this._centeredSlides = isTrueProperty(val); + } + private _centeredSlides: boolean = false; + /** * @hidden */ @@ -381,10 +393,6 @@ export class Slides extends Ion { * @hidden */ slidesPerGroup = 1; - /** - * @hidden - */ - centeredSlides = false; /** * @hidden */ diff --git a/src/components/slides/test/options/main.html b/src/components/slides/test/options/main.html index 48d2a59fe7..4c52de75f0 100644 --- a/src/components/slides/test/options/main.html +++ b/src/components/slides/test/options/main.html @@ -5,7 +5,8 @@ (ionSlideDrag)="onSlideDrag($event)" pager="true" effect="slide" - slidesPerView="2" + slidesPerView="2.1" + centeredSlides="true" spaceBetween="40">