Skip to content

Commit

Permalink
(feature) add swipe back to rooms list
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine92190 committed Jul 24, 2021
1 parent b8e31d6 commit 173ffdc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/lib/Room/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div
v-show="(isMobile && !showRoomsList) || !isMobile || singleRoom"
class="vac-col-messages"
@touchstart="touchStart"
>
<slot v-if="showNoRoom" name="no-room-selected">
<div class="vac-container-center vac-room-empty">
Expand Down Expand Up @@ -562,6 +563,26 @@ export default {
},
methods: {
touchStart(touchEvent) {
if (touchEvent.changedTouches.length === 1) {
const posXStart = touchEvent.changedTouches[0].clientX
addEventListener(
'touchend',
touchEvent => this.touchEnd(touchEvent, posXStart),
{ once: true }
)
}
},
touchEnd(touchEvent, posXStart) {
if (touchEvent.changedTouches.length === 1) {
const posXEnd = touchEvent.changedTouches[0].clientX
if (posXEnd - posXStart > 30) {
this.$emit('toggle-rooms-list')
}
}
},
onRoomChanged() {
this.loadingMessages = true
this.scrollIcon = false
Expand Down

0 comments on commit 173ffdc

Please sign in to comment.