From 5e0cb799bd9ecc9a98fd0a54250167d627901646 Mon Sep 17 00:00:00 2001 From: Vladimir Poleh Date: Sat, 11 Jan 2020 01:06:00 +0300 Subject: [PATCH] Fix boxes and circles drawing. --- src/Greenshot.Gfx/Legacy/ScaleHelper.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Greenshot.Gfx/Legacy/ScaleHelper.cs b/src/Greenshot.Gfx/Legacy/ScaleHelper.cs index 7be09e7c1..0759bbdcc 100644 --- a/src/Greenshot.Gfx/Legacy/ScaleHelper.cs +++ b/src/Greenshot.Gfx/Legacy/ScaleHelper.cs @@ -1,19 +1,19 @@ // Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom -// +// // For more information see: http://getgreenshot.org/ // The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot -// +// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 1 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program. If not, see . @@ -30,7 +30,6 @@ namespace Greenshot.Gfx.Legacy /// public static partial class ScaleHelper { - /// /// calculates the Size an element must be resized to, in order to fit another element, keeping aspect ratio /// @@ -323,7 +322,7 @@ namespace Greenshot.Gfx.Legacy } /// - /// + /// /// /// /// @@ -335,7 +334,7 @@ namespace Greenshot.Gfx.Legacy } /// - /// + /// /// /// /// @@ -348,7 +347,7 @@ namespace Greenshot.Gfx.Legacy } /// - /// + /// /// /// /// @@ -377,12 +376,16 @@ namespace Greenshot.Gfx.Legacy boundsAfterResize = boundsAfterResize.Resize((float)Math.Round(dist * Math.Cos(angle / 180 * Math.PI)), (float)Math.Round(dist * Math.Sin(angle / 180 * Math.PI))); } + else + { + boundsAfterResize = boundsAfterResize.Resize(cursorX - boundsBeforeResize.Left, cursorY - boundsBeforeResize.Top); + } if (centeredScale) { var wdiff = boundsAfterResize.Width - boundsBeforeResize.Width; var hdiff = boundsAfterResize.Height - boundsBeforeResize.Height; - boundsAfterResize = boundsAfterResize.Offset(-wdiff, -hdiff).Resize(boundsAfterResize.Width + wdiff, boundsAfterResize.Height + hdiff); + boundsAfterResize = boundsAfterResize.Offset(-wdiff, -hdiff).Resize(boundsAfterResize.Width + wdiff, boundsAfterResize.Height + hdiff); } }