mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(mobile): Improve vertical swipe detection in gallery viewer (#3486)
* Improve vertical swipe detection in gallery viewer * Use final
This commit is contained in:
parent
e0a3e5a200
commit
a9cd3609dd
1 changed files with 4 additions and 2 deletions
|
|
@ -239,6 +239,7 @@ class GalleryViewerPage extends HookConsumerWidget {
|
||||||
void handleSwipeUpDown(DragUpdateDetails details) {
|
void handleSwipeUpDown(DragUpdateDetails details) {
|
||||||
int sensitivity = 15;
|
int sensitivity = 15;
|
||||||
int dxThreshold = 50;
|
int dxThreshold = 50;
|
||||||
|
double ratioThreshold = 3.0;
|
||||||
|
|
||||||
if (isZoomed.value) {
|
if (isZoomed.value) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -256,9 +257,10 @@ class GalleryViewerPage extends HookConsumerWidget {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (details.delta.dy > sensitivity) {
|
final ratio = d.dy / max(d.dx.abs(), 1);
|
||||||
|
if (d.dy > sensitivity && ratio > ratioThreshold) {
|
||||||
AutoRouter.of(context).pop();
|
AutoRouter.of(context).pop();
|
||||||
} else if (details.delta.dy < -sensitivity) {
|
} else if (d.dy < -sensitivity && ratio < -ratioThreshold) {
|
||||||
showInfo();
|
showInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue