Skip to content

Commit

Permalink
fix(core): Slide bug with touch scroll, closes #465
Browse files Browse the repository at this point in the history
  • Loading branch information
MurhafSousli committed Oct 4, 2022
1 parent 18e320f commit eb1e60c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions projects/ng-gallery/src/lib/components/gallery-slider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,23 +159,25 @@ export class GallerySliderComponent implements OnInit, OnChanges, OnDestroy {
this._hammer.get('pan').set({ direction });

this._zone.runOutsideAngular(() => {
// Move the slider
this._hammer.on('pan', (e) => {

this._hammer.on('panmove', (e) => {
switch (this.config.slidingDirection) {
case SlidingDirection.Horizontal:
this.updateSlider({ value: e.deltaX, instant: true });
if (e.isFinal) {
this.updateSlider({ value: 0, instant: false });
this.horizontalPan(e);
}
break;
case SlidingDirection.Vertical:
this.updateSlider({ value: e.deltaY, instant: true });
if (e.isFinal) {
this.updateSlider({ value: 0, instant: false });
this.verticalPan(e);
}
}
});

this._hammer.on('panend', (e) => {
this.updateSlider({ value: 0, instant: false });
switch (this.config.slidingDirection) {
case SlidingDirection.Horizontal:
this.horizontalPan(e);
break;
case SlidingDirection.Vertical:
this.verticalPan(e);
}
});
});
Expand Down

0 comments on commit eb1e60c

Please sign in to comment.