瀏覽代碼

Fix scroll image when using touchpad

Ruben 5 月之前
父節點
當前提交
97d2ca11f8
共有 1 個文件被更改,包括 17 次插入6 次删除
  1. 17 6
      src/PicView.Avalonia/Views/ImageViewer.axaml.cs

+ 17 - 6
src/PicView.Avalonia/Views/ImageViewer.axaml.cs

@@ -62,12 +62,7 @@ public partial class ImageViewer : UserControl
     {
         if (DataContext is not MainViewModel mainViewModel)
             return;
-
-        if (Settings.Zoom.IsUsingTouchPad)
-        {
-            // Use touch gestures for zooming
-            return;
-        }
+        
         var ctrl = e.KeyModifiers == KeyModifiers.Control;
         var shift = e.KeyModifiers == KeyModifiers.Shift;
         var reverse = e.Delta.Y < 0;
@@ -78,6 +73,10 @@ public partial class ImageViewer : UserControl
             {
                 if (ctrl && !Settings.Zoom.CtrlZoom)
                 {
+                    if (Settings.Zoom.IsUsingTouchPad || e.Pointer.Type == PointerType.Touch)
+                    {
+                        return;
+                    }
                     await LoadNextPic();
                     return;
                 }
@@ -105,6 +104,10 @@ public partial class ImageViewer : UserControl
         {
             if (ctrl)
             {
+                if (Settings.Zoom.IsUsingTouchPad || e.Pointer.Type == PointerType.Touch)
+                {
+                    return;
+                }
                 if (reverse)
                 {
                     ZoomOut(e);
@@ -143,6 +146,10 @@ public partial class ImageViewer : UserControl
         {
             if (!Settings.Zoom.ScrollEnabled || e.KeyModifiers == KeyModifiers.Shift)
             {
+                if (Settings.Zoom.IsUsingTouchPad || e.Pointer.Type == PointerType.Touch)
+                {
+                    return;
+                }
                 await LoadNextPic();
             }
             else
@@ -167,6 +174,10 @@ public partial class ImageViewer : UserControl
 
         async Task LoadNextPic()
         {
+            if (Settings.Zoom.IsUsingTouchPad || e.Pointer.Type == PointerType.Touch)
+            {
+                return;
+            }
             bool next;
             if (reverse)
             {