aboutsummaryrefslogtreecommitdiff
path: root/src/components/media_modal
diff options
context:
space:
mode:
authorTusooa Zhu <tusooa@kazv.moe>2021-08-02 21:19:04 -0400
committerTusooa Zhu <tusooa@kazv.moe>2022-03-13 12:00:44 -0400
commit6980e4ddf1aa8dfd8c3bba0ea6cc7de90f531ba9 (patch)
treebd015030e00b9b28cb3479c390469ce3a944e0c7 /src/components/media_modal
parentcb19db1006e84d9429d57d8a574dfaa9980d8ca7 (diff)
Scale swipe threshold with viewport width
Diffstat (limited to 'src/components/media_modal')
-rw-r--r--src/components/media_modal/media_modal.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/components/media_modal/media_modal.js b/src/components/media_modal/media_modal.js
index 91413563..6a368508 100644
--- a/src/components/media_modal/media_modal.js
+++ b/src/components/media_modal/media_modal.js
@@ -33,7 +33,10 @@ const MediaModal = {
return {
loading: false,
swipeDirection: GestureService.DIRECTION_LEFT,
- swipeThreshold: 50,
+ swipeThreshold: () => {
+ const considerableMoveRatio = 1 / 4
+ return window.innerWidth * considerableMoveRatio
+ },
pinchZoomMinScale: 1,
pinchZoomScaleResetLimit: 1.2
}
@@ -104,7 +107,7 @@ const MediaModal = {
this.$refs.pinchZoom.setTransform({ scale: 1, x: 0, y: 0 })
if (sign > 0) {
this.goNext()
- } else {
+ } else if (sign < 0) {
this.goPrev()
}
},