From 99742ad05ad203c44b7ef8ed7a857a3de08d47dd Mon Sep 17 00:00:00 2001 From: Killy Date: Wed, 29 Apr 2020 23:23:29 +0300 Subject: [PATCH] Fix for Best Fit on images bigger than 4 times the available space --- Greenshot/Forms/ImageEditorForm.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs index ec53969f5..334a72dc3 100644 --- a/Greenshot/Forms/ImageEditorForm.cs +++ b/Greenshot/Forms/ImageEditorForm.cs @@ -1562,11 +1562,12 @@ namespace Greenshot { static bool isFit(int zoom, int source, int boundary) => source * zoom / 100 <= boundary; - var nextValue = Array.FindLast( + var nextIndex = Array.FindLastIndex( ZOOM_VALUES, zoom => isFit(zoom, imageSize.Width, maxImageSize.Width) && isFit(zoom, imageSize.Height, maxImageSize.Height) ); + var nextValue = nextIndex < 0 ? ZOOM_VALUES[0] : ZOOM_VALUES[nextIndex]; ZoomSetValue(nextValue); }