This commit is contained in:
Tusooa Zhu 2021-08-02 19:21:18 -04:00
parent 29cd8fbd3b
commit 23a6b86ef3
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
3 changed files with 15 additions and 45 deletions

View file

@ -37,7 +37,9 @@ const MediaModal = {
return {
loading: false,
swipeDirection: GestureService.DIRECTION_LEFT,
swipeThreshold: 50
swipeThreshold: 50,
pinchZoomMinScale: 1,
pinchZoomScaleResetLimit: 1.2
}
},
computed: {
@ -62,25 +64,6 @@ const MediaModal = {
type () {
return this.currentMedia ? this.getType(this.currentMedia) : null
},
scaling () {
return this.$store.state.mediaViewer.swipeScaler.scaling
},
offsets () {
return this.$store.state.mediaViewer.swipeScaler.offsets
},
transform () {
return `translate(${this.offsets[0]}px, ${this.offsets[1]}px) scale(${this.scaling}, ${this.scaling})`
}
},
created () {
// this.mediaGesture = new GestureService.SwipeAndScaleGesture({
// callbackPositive: this.goNext,
// callbackNegative: this.goPrev,
// swipePreviewCallback: this.handleSwipePreview,
// swipeEndCallback: this.handleSwipeEnd,
// pinchPreviewCallback: this.handlePinchPreview,
// pinchEndCallback: this.handlePinchEnd
// })
},
methods: {
getType (media) {

View file

@ -16,12 +16,11 @@
ref="pinchZoom"
class="modal-image-container-inner"
selector=".modal-image"
allow-pan-min-scale="1"
min-scale="1"
reset-to-min-scale-limit="1.2"
reach-min-scale-strategy="reset"
stop-propagate-handled="stop-propgate-handled"
:inner-class="'modal-image-container-inner'"
:allow-pan-min-scale="pinchZoomMinScale"
:min-scale="pinchZoomMinScale"
:reset-to-min-scale-limit="pinchZoomScaleResetLimit"
>
<img
v-if="type === 'image'"