Procházet zdrojové kódy

Improved handling of scaling on DataEntryPanel

Kenric Nugteren před 1 rokem
rodič
revize
758d21ef1a

+ 8 - 0
prs.desktop/Panels/DataEntry/DataEntryList.xaml.cs

@@ -272,6 +272,8 @@ public partial class DataEntryList : UserControl, ICorePanel, IDockPanel
             }
         }
         ViewDocuments.Clear();
+
+        var maxWidth = 0.0;
         foreach (var scan in SelectedScans)
         {
             if (bitmaps.TryGetValue(scan.Document.ID, out var list))
@@ -279,6 +281,7 @@ public partial class DataEntryList : UserControl, ICorePanel, IDockPanel
                 int page = 1;
                 foreach (var bitmap in list)
                 {
+                    maxWidth = Math.Max(maxWidth, bitmap.Width);
                     ViewDocuments.Add(new(bitmap, scan, page));
                     page++;
                 }
@@ -292,6 +295,11 @@ public partial class DataEntryList : UserControl, ICorePanel, IDockPanel
             {
                 ViewList.Add(doc.Image);
             }
+            if(maxWidth != 0.0)
+            {
+                ZoomPanel.Scale = ZoomPanel.ActualWidth / (maxWidth * 1.1);
+                ZoomPanel.MinScale = ZoomPanel.Scale / 2;
+            }
         }
     }