Fix diff for ScaleHelper

This commit is contained in:
Julien Richard 2023-08-26 18:29:48 +02:00
commit 5e7b5162d9
No known key found for this signature in database

View file

@ -33,7 +33,7 @@ namespace Greenshot.Editor.Helpers
/// </summary> /// </summary>
public static class ScaleHelper public static class ScaleHelper
{ {
/// <summary> /// <summary>
/// calculates the Size an element must be resized to, in order to fit another element, keeping aspect ratio /// calculates the Size an element must be resized to, in order to fit another element, keeping aspect ratio
/// </summary> /// </summary>
/// <param name="currentSize">the size of the element to be resized</param> /// <param name="currentSize">the size of the element to be resized</param>
@ -215,14 +215,15 @@ namespace Greenshot.Editor.Helpers
/// <param name="cursorX">int</param> /// <param name="cursorX">int</param>
/// <param name="cursorY">int</param> /// <param name="cursorY">int</param>
/// <param name="angleRoundBehavior">IDoubleProcessor</param> /// <param name="angleRoundBehavior">IDoubleProcessor</param>
/// <param name="options">ScaleOptionsProcessor</param> /// <param name="scaleOptions">ScaleOptions</param>
/// <returns>NativeRectFloat</returns> /// <returns>NativeRectFloat</returns>
public static NativeRectFloat Scale(NativeRect boundsBeforeResize, int cursorX, int cursorY, IDoubleProcessor angleRoundBehavior, ScaleOptions? options = null) public static NativeRectFloat Scale(NativeRect boundsBeforeResize, int cursorX, int cursorY, IDoubleProcessor angleRoundBehavior, ScaleOptions? scaleOptions = null)
{ {
options ??= GetScaleOptions(); scaleOptions ??= GetScaleOptions();
NativeRectFloat result = boundsBeforeResize; NativeRectFloat result = boundsBeforeResize;
bool rationalScale = (options & ScaleOptions.Rational) == ScaleOptions.Rational; bool rationalScale = (scaleOptions & ScaleOptions.Rational) == ScaleOptions.Rational;
bool centeredScale = (options & ScaleOptions.Centered) == ScaleOptions.Centered; bool centeredScale = (scaleOptions & ScaleOptions.Centered) == ScaleOptions.Centered;
if (rationalScale) if (rationalScale)
{ {
@ -260,5 +261,5 @@ namespace Greenshot.Editor.Helpers
if (maintainAspectRatio) opts |= ScaleOptions.Rational; if (maintainAspectRatio) opts |= ScaleOptions.Rational;
return opts; return opts;
} }
} }
} }