@@ -9,6 +9,8 @@ import Chip from 'primevue/chip';
9
9
import MultiSelect from ' primevue/multiselect' ;
10
10
import Button from ' primevue/button' ;
11
11
import { useConfirm } from ' primevue/useconfirm' ;
12
+ import type { UseSwipeDirection } from ' @vueuse/core' ;
13
+ import { useSwipe } from ' @vueuse/core' ;
12
14
13
15
import socket from ' @/utils/socket' ;
14
16
import emitter from ' @/services/emitter.service' ;
@@ -290,6 +292,7 @@ const fixSelectPanel = (value: boolean) => {
290
292
291
293
const closeModal = () => {
292
294
modal .value .show = false ;
295
+ document .body .style .overflow = ' auto' ;
293
296
setTimeout (() => {
294
297
modal .value .src = ' ' ;
295
298
aspectRatio .value .image = 0 ;
@@ -397,6 +400,7 @@ onBeforeMount(() => {
397
400
if (image && image .filename ) {
398
401
modal .value .show = true ;
399
402
modal .value .image = image ;
403
+ document .body .style .overflow = ' hidden' ;
400
404
}
401
405
402
406
loadModalImage (image );
@@ -485,6 +489,15 @@ watch(
485
489
await getGallery ();
486
490
},
487
491
);
492
+ const swipe = ref <HTMLElement | null >(null );
493
+ if (window .matchMedia (' (pointer: coarse)' ).matches ) {
494
+ useSwipe (swipe , {
495
+ passive: false ,
496
+ onSwipeEnd(e : TouchEvent , direction : UseSwipeDirection ) {
497
+ modalImage (direction === ' left' ? ' next' : ' prev' );
498
+ },
499
+ });
500
+ }
488
501
</script >
489
502
490
503
<template >
@@ -513,7 +526,7 @@ watch(
513
526
></i >
514
527
<i class =" fas fa-trash-can" @click =" deleteImage(modal.image.id)" ></i >
515
528
</div >
516
- <img :src =" modal.src" class =" border-round" />
529
+ <img ref = " swipe " :src =" modal.src" class =" border-round" />
517
530
<p >{{ modal.summary }}</p >
518
531
<div class =" text-center chip-wrapper w-full" >
519
532
<Chip :label =" modal.image.meta.ai" class =" text-xs mr-2" />
0 commit comments