Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Set swipeActiveNotifier to true also if there was no horizontal drag and only vertical drag, given that the drag is a continuation of the long press gesture that was done for the first selection of an item in gallery

ashilknf74e87b689f7
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/swipe_selection_wrapper.dart b/mobile/apps/photos/lib/ui/viewer/gallery/swipe_selection_wrapper.dart
index 6a6ffe4742..8f98bf124a 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/swipe_selection_wrapper.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/swipe_selection_wrapper.dart
@@ -51,8 +51,21 @@ class _SwipeSelectionWrapperState extends State<SwipeSelectionWrapper> {
_initialMovementWasHorizontal = null;
},
onPointerMove: (event) {
- // Only check for horizontal swipe if files are selected and swipe is not already active
- if (!widget.swipeActiveNotifier.value &&
+ // Handle case where pointer is dragged after first selection in gallery
+ if (widget.selectedFiles != null &&
+ widget.selectedFiles!.files.length == 1 &&
+ !widget.swipeActiveNotifier.value) {
+ // Activate swipe mode for any significant movement when only one file is selected
+ // This handles the case of long-press to select first file, then immediate swipe
+ // including vertical movement without initial horizontal movement
+ final dx = event.delta.dx.abs();
+ final dy = event.delta.dy.abs();
+ if (dx > 0.1 || dy > 0.1) {
+ widget.swipeActiveNotifier.value = true;
+ }
+ }
+ // Check for horizontal swipe if multiple files are selected and swipe is not already active
+ else if (!widget.swipeActiveNotifier.value &&
widget.selectedFiles != null &&
widget.selectedFiles!.files.isNotEmpty) {
// Check if movement is primarily horizontal and if delta x is significant
@@ -71,18 +84,6 @@ class _SwipeSelectionWrapperState extends State<SwipeSelectionWrapper> {
widget.swipeActiveNotifier.value = true;
}
}
- // To handle case where pointer is dragged after first selection in gallery
- else if (widget.selectedFiles != null &&
- widget.selectedFiles!.files.isNotEmpty &&
- widget.selectedFiles!.files.length == 1 &&
- !widget.swipeActiveNotifier.value) {
- // Check if this is horizontal movement when only one file is selected
- final dx = event.delta.dx.abs();
- final dy = event.delta.dy.abs();
- if (dx > dy && dx > 0.1) {
- widget.swipeActiveNotifier.value = true;
- }
- }
},
onPointerUp: (_) {
// End swipe selection when pointer is released