Reset position on swipe end even if we cannot navigate
This commit is contained in:
parent
e2f3929872
commit
9d4dd64276
1 changed files with 2 additions and 5 deletions
|
@ -65,14 +65,12 @@ const MediaModal = {
|
|||
if (this.canNavigate) {
|
||||
const prevIndex = this.currentIndex === 0 ? this.media.length - 1 : (this.currentIndex - 1)
|
||||
this.$store.dispatch('setCurrent', this.media[prevIndex])
|
||||
this.$refs.pinchZoom.setTransform({ scale: 1, x: 0, y: 0 })
|
||||
}
|
||||
},
|
||||
goNext () {
|
||||
if (this.canNavigate) {
|
||||
const nextIndex = this.currentIndex === this.media.length - 1 ? 0 : (this.currentIndex + 1)
|
||||
this.$store.dispatch('setCurrent', this.media[nextIndex])
|
||||
this.$refs.pinchZoom.setTransform({ scale: 1, x: 0, y: 0 })
|
||||
}
|
||||
},
|
||||
handleSwipePreview (offsets) {
|
||||
|
@ -80,9 +78,8 @@ const MediaModal = {
|
|||
},
|
||||
handleSwipeEnd (sign) {
|
||||
console.log('handleSwipeEnd:', sign)
|
||||
if (sign === 0) {
|
||||
this.$refs.pinchZoom.setTransform({ scale: 1, x: 0, y: 0 })
|
||||
} else if (sign > 0) {
|
||||
this.$refs.pinchZoom.setTransform({ scale: 1, x: 0, y: 0 })
|
||||
if (sign > 0) {
|
||||
this.goNext()
|
||||
} else {
|
||||
this.goPrev()
|
||||
|
|
Loading…
Reference in a new issue