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
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PackageReference Include="BootstrapBlazor.Html2Image" Version="9.0.2" />
<PackageReference Include="BootstrapBlazor.Html2Pdf" Version="9.0.2" />
<PackageReference Include="BootstrapBlazor.IconPark" Version="9.0.3" />
<PackageReference Include="BootstrapBlazor.ImageCropper" Version="9.0.2" />
<PackageReference Include="BootstrapBlazor.ImageCropper" Version="9.0.3" />
<PackageReference Include="BootstrapBlazor.IP2Region" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.JitsiMeet" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.JuHeIpLocatorProvider" Version="9.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<PackageTips Name="BootstrapBlazor.ImageCropper" />

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

<div class="row g-3 mt-3">
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="X"></BootstrapInputGroupLabel>
<Display Value="_data.X"></Display>
<BootstrapInputGroupLabel DisplayText="px"></BootstrapInputGroupLabel>
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="Y"></BootstrapInputGroupLabel>
<Display Value="_data.Y"></Display>
<BootstrapInputGroupLabel DisplayText="px"></BootstrapInputGroupLabel>
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="Width"></BootstrapInputGroupLabel>
<Display Value="_data.Width"></Display>
<BootstrapInputGroupLabel DisplayText="px"></BootstrapInputGroupLabel>
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="Height"></BootstrapInputGroupLabel>
<Display Value="_data.Height"></Display>
<BootstrapInputGroupLabel DisplayText="px"></BootstrapInputGroupLabel>
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="Rotate"></BootstrapInputGroupLabel>
<Display Value="_data.Rotate"></Display>
<BootstrapInputGroupLabel DisplayText="deg"></BootstrapInputGroupLabel>
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6 d-none d-sm-flex">
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Remove or clarify empty grid cell

Consider removing this empty

. If spacing is needed, use a spacer class or adjust the grid layout.

</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="ScaleX"></BootstrapInputGroupLabel>
<Display Value="_data.ScaleX"></Display>
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="ScaleY"></BootstrapInputGroupLabel>
<Display Value="_data.ScaleY"></Display>
</BootstrapInputGroup>
</div>
</div>

@if (!string.IsNullOrEmpty(_base64String))
{
<img src="@_base64String" style="width: 240px; margin-top: 1rem;" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ private async Task RoundCrop()

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

private ImageCropperData _data = new();
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Initial crop data remains zero until first event

Initialize _data with the cropper’s current state, such as by calling your handler in OnAfterRenderAsync, so the UI shows the initial crop settings immediately.

private Task OnCropChangedAsync(ImageCropperData data)
{
_data = data;
StateHasChanged();
return Task.CompletedTask;
}

private AttributeItem[] GetAttributes() =>
[
new()
Expand Down