Skip to content

Commit 173ffdc

Browse files
committed
(feature) add swipe back to rooms list
1 parent b8e31d6 commit 173ffdc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/lib/Room/Room.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div
33
v-show="(isMobile && !showRoomsList) || !isMobile || singleRoom"
44
class="vac-col-messages"
5+
@touchstart="touchStart"
56
>
67
<slot v-if="showNoRoom" name="no-room-selected">
78
<div class="vac-container-center vac-room-empty">
@@ -562,6 +563,26 @@ export default {
562563
},
563564
564565
methods: {
566+
touchStart(touchEvent) {
567+
if (touchEvent.changedTouches.length === 1) {
568+
const posXStart = touchEvent.changedTouches[0].clientX
569+
570+
addEventListener(
571+
'touchend',
572+
touchEvent => this.touchEnd(touchEvent, posXStart),
573+
{ once: true }
574+
)
575+
}
576+
},
577+
touchEnd(touchEvent, posXStart) {
578+
if (touchEvent.changedTouches.length === 1) {
579+
const posXEnd = touchEvent.changedTouches[0].clientX
580+
581+
if (posXEnd - posXStart > 30) {
582+
this.$emit('toggle-rooms-list')
583+
}
584+
}
585+
},
565586
onRoomChanged() {
566587
this.loadingMessages = true
567588
this.scrollIcon = false

0 commit comments

Comments
 (0)