Explorar o código

Fix panning behavior: stop capturing when Shift key is pressed during zoom #242

Ruben hai 2 meses
pai
achega
eeb6e5a72b
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      src/PicView.Avalonia/ImageTransformations/Zoom.cs

+ 7 - 1
src/PicView.Avalonia/ImageTransformations/Zoom.cs

@@ -308,11 +308,17 @@ public class Zoom
     /// <param name="imageViewer">The image viewer instance on which the panning operation is performed.</param>
     public void Pan(PointerEventArgs e, ImageViewer imageViewer)
     {
-        if (!_captured || _scaleTransform == null || !IsZoomed || e.KeyModifiers == KeyModifiers.Shift)
+        if (!_captured || _scaleTransform == null || !IsZoomed)
         {
             return;
         }
 
+        if (e.KeyModifiers == KeyModifiers.Shift)
+        {
+            _captured = false;
+            return;
+        }
+
         var dragMousePosition = _start - e.GetPosition(imageViewer);
 
         // Get the current rotation angle from the ViewModel