Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>9.0.0</Version>
<Version>9.0.1</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ImageCropperOption
/// </summary>
/// <remarks>默认情况下,裁剪框具有自由比例。 设置为1, 裁剪区默认正方形</remarks>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Update remarks to mention fractional aspect ratios

Please update the XML documentation to specify that floating-point aspect ratios (e.g., 1.5) are now supported.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? AspectRatio { get; set; }
public float? AspectRatio { get; set; }
Comment on lines 37 to +38
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Validate that AspectRatio is positive and non-zero

Enforce AspectRatio > 0 in the setter or validate it in OnParametersSet to prevent undefined behavior.

Suggested change
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? AspectRatio { get; set; }
public float? AspectRatio { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
private float? _aspectRatio;
public float? AspectRatio
{
get => _aspectRatio;
set
{
if (value.HasValue && value.Value <= 0)
{
throw new ArgumentOutOfRangeException(nameof(AspectRatio), "AspectRatio must be positive and non-zero.");
}
_aspectRatio = value;
}
}


/// <summary>
/// Re-render the cropper when resizing the window. default tue
Expand Down