Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 829bf78

Browse files
fix: slide with swiper
1 parent 62cc9fc commit 829bf78

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/deck/deckdeckgo-deck/deckdeckgo-deck.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,20 @@ export class DeckdeckgoDeck {
140140
return;
141141
}
142142

143+
143144
const couldSwipeLeft: boolean = deltaX.swipeLeft && this.activeIndex < this.length - 1;
144145
const couldSwipeRight: boolean = !deltaX.swipeLeft && this.activeIndex > 0;
145146

146147
if (couldSwipeLeft || couldSwipeRight) {
147148
const windowWidth: number = window.outerWidth;
148149
if (deltaX.deltaX > (windowWidth / this.autoSwipeRatio)) {
149150
this.deckTranslateX = deltaX.swipeLeft ? this.deckTranslateX - windowWidth : this.deckTranslateX + windowWidth;
150-
}
151151

152-
if (deltaX.swipeLeft) {
153-
this.activeIndex++;
154-
} else {
155-
this.activeIndex--;
152+
if (deltaX.swipeLeft) {
153+
this.activeIndex++;
154+
} else {
155+
this.activeIndex--;
156+
}
156157
}
157158
}
158159

0 commit comments

Comments
 (0)