Browse Source

Fixed zooming out

MarcinZiabek 3 years ago
parent
commit
e430484e85
1 changed files with 2 additions and 2 deletions
  1. 2 2
      QuestPDF.Previewer/InteractiveCanvas.cs

+ 2 - 2
QuestPDF.Previewer/InteractiveCanvas.cs

@@ -62,14 +62,14 @@ class InteractiveCanvas : ICustomDrawOperation
     
     private void LimitTranslate()
     {
-        if (TotalPagesHeight * Scale > Height)
+        if (TotalPagesHeight > Height / Scale)
         {
             TranslateY = Math.Min(TranslateY, MaxTranslateY);
             TranslateY = Math.Max(TranslateY, 0);
         }
         else
         {
-            TranslateY = -TotalPagesHeight / 2;
+            TranslateY = (TotalPagesHeight - Height / Scale) / 2;
         }
 
         if (Width / Scale < MaxWidth)