forked from AkkomaGang/akkoma-fe
Lightbox/modal multi image improvements - #381
This commit is contained in:
parent
df18ef30d0
commit
f66026bf20
2 changed files with 32 additions and 11 deletions
|
@ -2,6 +2,7 @@ import StillImage from '../still-image/still-image.vue'
|
||||||
import VideoAttachment from '../video_attachment/video_attachment.vue'
|
import VideoAttachment from '../video_attachment/video_attachment.vue'
|
||||||
import Modal from '../modal/modal.vue'
|
import Modal from '../modal/modal.vue'
|
||||||
import fileTypeService from '../../services/file_type/file_type.service.js'
|
import fileTypeService from '../../services/file_type/file_type.service.js'
|
||||||
|
import GestureService from '../../services/gesture_service/gesture_service'
|
||||||
|
|
||||||
const MediaModal = {
|
const MediaModal = {
|
||||||
components: {
|
components: {
|
||||||
|
@ -29,7 +30,27 @@ const MediaModal = {
|
||||||
return this.currentMedia ? fileTypeService.fileType(this.currentMedia.mimetype) : null
|
return this.currentMedia ? fileTypeService.fileType(this.currentMedia.mimetype) : null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
this.mediaSwipeGestureRight = GestureService.swipeGesture(
|
||||||
|
GestureService.DIRECTION_RIGHT,
|
||||||
|
this.goPrev,
|
||||||
|
50
|
||||||
|
)
|
||||||
|
this.mediaSwipeGestureLeft = GestureService.swipeGesture(
|
||||||
|
GestureService.DIRECTION_LEFT,
|
||||||
|
this.goNext,
|
||||||
|
50
|
||||||
|
)
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
mediaTouchStart (e) {
|
||||||
|
GestureService.beginSwipe(e, this.mediaSwipeGestureRight)
|
||||||
|
GestureService.beginSwipe(e, this.mediaSwipeGestureLeft)
|
||||||
|
},
|
||||||
|
mediaTouchMove (e) {
|
||||||
|
GestureService.updateSwipe(e, this.mediaSwipeGestureRight)
|
||||||
|
GestureService.updateSwipe(e, this.mediaSwipeGestureLeft)
|
||||||
|
},
|
||||||
hide () {
|
hide () {
|
||||||
this.$store.dispatch('closeMediaViewer')
|
this.$store.dispatch('closeMediaViewer')
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
v-if="type === 'image'"
|
v-if="type === 'image'"
|
||||||
class="modal-image"
|
class="modal-image"
|
||||||
:src="currentMedia.url"
|
:src="currentMedia.url"
|
||||||
|
@touchstart.stop="mediaTouchStart"
|
||||||
|
@touchmove.stop="mediaTouchMove"
|
||||||
>
|
>
|
||||||
<VideoAttachment
|
<VideoAttachment
|
||||||
v-if="type === 'video'"
|
v-if="type === 'video'"
|
||||||
|
@ -41,18 +43,16 @@
|
||||||
.modal-view.media-modal-view {
|
.modal-view.media-modal-view {
|
||||||
z-index: 1001;
|
z-index: 1001;
|
||||||
|
|
||||||
&:hover {
|
.modal-view-button-arrow {
|
||||||
.modal-view-button-arrow {
|
opacity: 0.75;
|
||||||
opacity: 0.75;
|
|
||||||
|
|
||||||
&:focus,
|
&:focus,
|
||||||
&:hover {
|
&:hover {
|
||||||
outline: none;
|
outline: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue