Skip to content

Commit a9b2121

Browse files
authored
Merge branch '9.0.x' into dmdimitrov/issue7343-9.0.x
2 parents 6997082 + 0b164b4 commit a9b2121

File tree

2 files changed

+36
-19
lines changed

2 files changed

+36
-19
lines changed

projects/igniteui-angular/src/lib/carousel/carousel.component.ts

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
437437
private newDuration = 0;
438438

439439
constructor(private element: ElementRef, private iterableDiffers: IterableDiffers,
440-
private builder: AnimationBuilder, private platformUtil: PlatformUtil) {
440+
private builder: AnimationBuilder, private platformUtil: PlatformUtil) {
441441
this.differ = this.iterableDiffers.find([]).create(null);
442442
}
443443

@@ -472,15 +472,18 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
472472
}
473473

474474
if (this.currentSlide) {
475-
const animationWasStarted = this.finishAnimations();
475+
if (this.previousSlide && this.previousSlide.previous) {
476+
this.previousSlide.previous = false;
477+
}
476478
this.currentSlide.direction = slide.direction;
477479
this.currentSlide.active = false;
478480

479481
this.previousSlide = this.currentSlide;
480482
this.currentSlide = slide;
481483
if (this.animationType !== CarouselAnimationType.none) {
482-
if (animationWasStarted) {
484+
if (this.animationStarted(this.leaveAnimationPlayer) || this.animationStarted(this.enterAnimationPlayer)) {
483485
requestAnimationFrame(() => {
486+
this.resetAnimations();
484487
this.playAnimations();
485488
});
486489
} else {
@@ -500,20 +503,28 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
500503
this.playEnterAnimation();
501504
}
502505

503-
private finishAnimations(): boolean {
504-
let animationWasStarted = false;
505-
if (this.previousSlide && this.previousSlide.previous) {
506-
this.previousSlide.previous = false;
507-
}
508-
if (this.leaveAnimationPlayer) {
509-
animationWasStarted = true;
506+
private finishAnimations() {
507+
if (this.animationStarted(this.leaveAnimationPlayer)) {
510508
this.leaveAnimationPlayer.finish();
511509
}
512-
if (this.enterAnimationPlayer) {
513-
animationWasStarted = true;
510+
511+
if (this.animationStarted(this.enterAnimationPlayer)) {
514512
this.enterAnimationPlayer.finish();
515513
}
516-
return animationWasStarted;
514+
}
515+
516+
private resetAnimations() {
517+
if (this.animationStarted(this.leaveAnimationPlayer)) {
518+
this.leaveAnimationPlayer.reset();
519+
}
520+
521+
if (this.animationStarted(this.enterAnimationPlayer)) {
522+
this.enterAnimationPlayer.reset();
523+
}
524+
}
525+
526+
private animationStarted(animation: AnimationPlayer): boolean {
527+
return animation && animation.hasStarted();
517528
}
518529

519530
private getAnimation(): CarouselAnimationSettings {
@@ -565,10 +576,11 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
565576
}
566577

567578
private playEnterAnimation() {
568-
if (!this.getAnimation().enterAnimation) {
579+
const animation = this.getAnimation().enterAnimation;
580+
if (!animation) {
569581
return;
570582
}
571-
const animationBuilder = this.builder.build(this.getAnimation().enterAnimation);
583+
const animationBuilder = this.builder.build(animation);
572584

573585
this.enterAnimationPlayer = animationBuilder.create(this.currentSlide.nativeElement);
574586

@@ -586,11 +598,12 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
586598
}
587599

588600
private playLeaveAnimation() {
589-
if (!this.getAnimation().leaveAnimation) {
601+
const animation = this.getAnimation().leaveAnimation;
602+
if (!animation) {
590603
return;
591604
}
592605

593-
const animationBuilder = this.builder.build(this.getAnimation().leaveAnimation);
606+
const animationBuilder = this.builder.build(animation);
594607
this.leaveAnimationPlayer = animationBuilder.create(this.previousSlide.nativeElement);
595608

596609
this.leaveAnimationPlayer.onDone(() => {
@@ -1021,6 +1034,10 @@ export class IgxCarouselComponent implements OnDestroy, AfterContentInit {
10211034
this.stoppedByInteraction = true;
10221035
this.stop();
10231036
}
1037+
1038+
if (this.previousSlide && this.previousSlide.previous) {
1039+
this.previousSlide.previous = false;
1040+
}
10241041
this.finishAnimations();
10251042

10261043
if (this.incomingSlide) {

projects/igniteui-angular/src/lib/grids/grid/grid-row.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
[editMode]="col.editable && crudService.isInEditMode(index, col.index)"
133133
[column]="col"
134134
[style.-ms-grid-row-span]="col.gridRowSpan"
135-
[style.-ms-grid-column-span]="col.girdColumnSpan"
135+
[style.-ms-grid-column-span]="col.gridColumnSpan"
136136
[style.grid-row-end]="col.rowEnd"
137137
[style.grid-column-end]="col.colEnd"
138138
[style.-ms-grid-row]="col.rowStart"
@@ -163,7 +163,7 @@
163163
[editMode]="col.editable && crudService.isInEditMode(index, col.index)"
164164
[column]="col"
165165
[style.-ms-grid-row-span]="col.gridRowSpan"
166-
[style.-ms-grid-column-span]="col.girdColumnSpan"
166+
[style.-ms-grid-column-span]="col.gridColumnSpan"
167167
[style.grid-row-end]="col.rowEnd"
168168
[style.grid-column-end]="col.colEnd"
169169
[style.-ms-grid-row]="col.rowStart"

0 commit comments

Comments
 (0)