Skip to content

Commit 219fe6b

Browse files
committed
(fix) swipe to toggle rooms list
1 parent b596a5d commit 219fe6b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/lib/Room/Room.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,19 +549,24 @@ export default {
549549
touchStart(touchEvent) {
550550
if (touchEvent.changedTouches.length === 1) {
551551
const posXStart = touchEvent.changedTouches[0].clientX
552+
const posYStart = touchEvent.changedTouches[0].clientY
552553
553554
addEventListener(
554555
'touchend',
555-
touchEvent => this.touchEnd(touchEvent, posXStart),
556+
touchEvent => this.touchEnd(touchEvent, posXStart, posYStart),
556557
{ once: true }
557558
)
558559
}
559560
},
560-
touchEnd(touchEvent, posXStart) {
561+
touchEnd(touchEvent, posXStart, posYStart) {
561562
if (touchEvent.changedTouches.length === 1) {
562563
const posXEnd = touchEvent.changedTouches[0].clientX
564+
const posYEnd = touchEvent.changedTouches[0].clientY
563565
564-
if (posXEnd - posXStart > 30) {
566+
const swippedRight = posXEnd - posXStart > 30
567+
const swippedVertically = Math.abs(posYEnd - posYStart) > 50
568+
569+
if (swippedRight && !swippedVertically) {
565570
this.$emit('toggle-rooms-list')
566571
}
567572
}

0 commit comments

Comments
 (0)