Use existing value +/- correction to calculate new values for clip rectangle

This commit is contained in:
Nathan Brown 2025-05-28 23:09:42 -07:00
commit dd21b1407d

View file

@ -1769,12 +1769,16 @@ namespace Greenshot.Editor.Drawing
int verticalCorrection = targetClipRectangle.Top % (int) _zoomFactor.Numerator;
if (horizontalCorrection != 0)
{
targetClipRectangle = targetClipRectangle.ChangeX(-horizontalCorrection).ChangeWidth(horizontalCorrection);
targetClipRectangle = targetClipRectangle
.ChangeX(targetClipRectangle.X - horizontalCorrection)
.ChangeWidth(targetClipRectangle.Width + horizontalCorrection);
}
if (verticalCorrection != 0)
{
targetClipRectangle = targetClipRectangle.ChangeY(-verticalCorrection).ChangeHeight(verticalCorrection);
targetClipRectangle = targetClipRectangle
.ChangeY(targetClipRectangle.Y - verticalCorrection)
.ChangeHeight(targetClipRectangle.Height + verticalCorrection);
}
}