فهرست منبع

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