Skip to content

Commit

Permalink
feat: Transition duration on last slide closes #15
Browse files Browse the repository at this point in the history
  • Loading branch information
makiJS committed Jul 12, 2019
1 parent 19dfe6f commit de66c43
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions projects/ng-slider/src/lib/slides/slides.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {
inPan = false;
mouseOver = false;
blockAutoSlide = false;
blockSlideAnimation = false;

timerReset$: BehaviorSubject<boolean>;

Expand Down Expand Up @@ -116,6 +117,7 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {
});

this.slider.jumpToSlide$.subscribe(num => {
this.inPan = true;
this.left = -this.slideWidthPercentage * num;

this._resetTimer();
Expand All @@ -129,6 +131,7 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {
slides: this.slides,
slideWidthPercentage: this.slideWidthPercentage
});
this.inPan = false;

this.change.next({
index: num,
Expand Down Expand Up @@ -185,6 +188,7 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {
const gap = this.slideWidthPercentage * (amount - 1);
const loop = this.options.loop;

this.inPan = true;
switch (true) {
case nextPosition < this.maxLeft && nextPosition >= this.maxLeft - gap:
case nextPosition < this.maxLeft &&
Expand All @@ -208,6 +212,7 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {
break;
default:
this.left = nextPosition;
this.inPan = false;
}

this._shouldEmitSlideInView(amount, move);
Expand Down

0 comments on commit de66c43

Please sign in to comment.