Skip to content

Commit a6e1b04

Browse files
authored
feat(ImageCropper): add OnCropChangedAsync parameter (#6179)
* chore: bump version 9.0.3 * feat(ImageCropper): add OnCropChangedAsync parameter
1 parent 9a88fa6 commit a6e1b04

File tree

3 files changed

+62
-2
lines changed

3 files changed

+62
-2
lines changed

src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<PackageReference Include="BootstrapBlazor.Html2Image" Version="9.0.2" />
4444
<PackageReference Include="BootstrapBlazor.Html2Pdf" Version="9.0.2" />
4545
<PackageReference Include="BootstrapBlazor.IconPark" Version="9.0.3" />
46-
<PackageReference Include="BootstrapBlazor.ImageCropper" Version="9.0.2" />
46+
<PackageReference Include="BootstrapBlazor.ImageCropper" Version="9.0.3" />
4747
<PackageReference Include="BootstrapBlazor.IP2Region" Version="9.0.1" />
4848
<PackageReference Include="BootstrapBlazor.JitsiMeet" Version="9.0.0" />
4949
<PackageReference Include="BootstrapBlazor.JuHeIpLocatorProvider" Version="9.0.0" />

src/BootstrapBlazor.Server/Components/Samples/ImageCroppers.razor

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<PackageTips Name="BootstrapBlazor.ImageCropper" />
88

99
<DemoBlock Title="@Localizer["ImageCropperNormalText"]" Introduction="@Localizer["ImageCropperNormalIntro"]" Name="Normal">
10-
<ImageCropper @ref="_cropper" Url="@_images[0]" Options="_roundOptions1"></ImageCropper>
10+
<ImageCropper @ref="_cropper" Url="@_images[0]" Options="_roundOptions1" OnCropChangedAsync="OnCropChangedAsync"></ImageCropper>
1111
<section ignore>
1212
<BootstrapInputGroup>
1313
<Button Text="OK" OnClick="Crop"></Button>
@@ -26,6 +26,58 @@
2626
<div class="bb-cropper-preview bb-cropper-preview1 bb-cropper-preview-xs"></div>
2727
</div>
2828

29+
<div class="row g-3 mt-3">
30+
<div class="col-12 col-sm-6">
31+
<BootstrapInputGroup>
32+
<BootstrapInputGroupLabel DisplayText="X"></BootstrapInputGroupLabel>
33+
<Display Value="_data.X"></Display>
34+
<BootstrapInputGroupLabel DisplayText="px"></BootstrapInputGroupLabel>
35+
</BootstrapInputGroup>
36+
</div>
37+
<div class="col-12 col-sm-6">
38+
<BootstrapInputGroup>
39+
<BootstrapInputGroupLabel DisplayText="Y"></BootstrapInputGroupLabel>
40+
<Display Value="_data.Y"></Display>
41+
<BootstrapInputGroupLabel DisplayText="px"></BootstrapInputGroupLabel>
42+
</BootstrapInputGroup>
43+
</div>
44+
<div class="col-12 col-sm-6">
45+
<BootstrapInputGroup>
46+
<BootstrapInputGroupLabel DisplayText="Width"></BootstrapInputGroupLabel>
47+
<Display Value="_data.Width"></Display>
48+
<BootstrapInputGroupLabel DisplayText="px"></BootstrapInputGroupLabel>
49+
</BootstrapInputGroup>
50+
</div>
51+
<div class="col-12 col-sm-6">
52+
<BootstrapInputGroup>
53+
<BootstrapInputGroupLabel DisplayText="Height"></BootstrapInputGroupLabel>
54+
<Display Value="_data.Height"></Display>
55+
<BootstrapInputGroupLabel DisplayText="px"></BootstrapInputGroupLabel>
56+
</BootstrapInputGroup>
57+
</div>
58+
<div class="col-12 col-sm-6">
59+
<BootstrapInputGroup>
60+
<BootstrapInputGroupLabel DisplayText="Rotate"></BootstrapInputGroupLabel>
61+
<Display Value="_data.Rotate"></Display>
62+
<BootstrapInputGroupLabel DisplayText="deg"></BootstrapInputGroupLabel>
63+
</BootstrapInputGroup>
64+
</div>
65+
<div class="col-12 col-sm-6 d-none d-sm-flex">
66+
</div>
67+
<div class="col-12 col-sm-6">
68+
<BootstrapInputGroup>
69+
<BootstrapInputGroupLabel DisplayText="ScaleX"></BootstrapInputGroupLabel>
70+
<Display Value="_data.ScaleX"></Display>
71+
</BootstrapInputGroup>
72+
</div>
73+
<div class="col-12 col-sm-6">
74+
<BootstrapInputGroup>
75+
<BootstrapInputGroupLabel DisplayText="ScaleY"></BootstrapInputGroupLabel>
76+
<Display Value="_data.ScaleY"></Display>
77+
</BootstrapInputGroup>
78+
</div>
79+
</div>
80+
2981
@if (!string.IsNullOrEmpty(_base64String))
3082
{
3183
<img src="@_base64String" style="width: 240px; margin-top: 1rem;" />

src/BootstrapBlazor.Server/Components/Samples/ImageCroppers.razor.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ private async Task RoundCrop()
5858

5959
private Task Rotate() => _cropper.Rotate(90);
6060

61+
private ImageCropperData _data = new();
62+
private Task OnCropChangedAsync(ImageCropperData data)
63+
{
64+
_data = data;
65+
StateHasChanged();
66+
return Task.CompletedTask;
67+
}
68+
6169
private AttributeItem[] GetAttributes() =>
6270
[
6371
new()

0 commit comments

Comments
 (0)