Skip to content

Commit

Permalink
feat(ImageCropper): support set crop shape (#14)
Browse files Browse the repository at this point in the history
* feat(ImageCropper): support set crop shape

* chore: 更新样式到最新

* refactor: 重构代码

* feat: 重构 crop replace reset 方法

* refactor: 重构客户端方法

* feat: 增加禁用逻辑

* refactor: 增加 canvas 销毁代码,防止内存泄漏

* refactor: 释放资源

* refactor: 重构 Options 增加文档注释

* refactor: 更新参数默认值减少通讯量

* refactor: 增加 IsRound 参数

---------

Co-authored-by: Argo Zhang <argo@live.ca>
  • Loading branch information
izanhzh and ArgoZhang authored Oct 12, 2024
1 parent ae0f37e commit 66608b5
Show file tree
Hide file tree
Showing 15 changed files with 3,718 additions and 4,133 deletions.
Original file line number Diff line number Diff line change
@@ -1,41 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup>
<Version>0.0.4</Version>
<PackageProjectUrl>https://github.com/densen2014/BootstrapBlazor.ImageCropper</PackageProjectUrl>
<RepositoryUrl>https://github.com/densen2014/BootstrapBlazor.ImageCropper</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>Bootstrap Blazor ImageCropper 图像裁剪 组件 </PackageTags>
<Description>Bootstrap UI ImageCropper components experience</Description>
<AssemblyName>BootstrapBlazor.ImageCropper</AssemblyName>
<RootNamespace>BootstrapBlazor.ImageCropper</RootNamespace>
<AssemblyOriginatorKeyFile>..\keys\Longbow.Utility.snk</AssemblyOriginatorKeyFile>
<SignAssembly>True</SignAssembly>
<OutputPath>..\..\..\Bin</OutputPath>
</PropertyGroup>
<PropertyGroup>
<Version>8.1.0</Version>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.10" />
</ItemGroup>
<PropertyGroup>
<PackageTags>Bootstrap Blazor WebAssembly wasm UI Components ImageCropper</PackageTags>
<Description>Bootstrap UI components extensions of ImageCropper</Description>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="8.10.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0" />
</ItemGroup>

<!-- 通过移除正常的引用并替换成固定版本的引用,达到无论如何更新都无法生效的目的。 -->
<Target Condition="'$(TargetFramework)' == 'net6.0'" Name="ReferenceStaticLegacyPackage" BeforeTargets="CollectPackageReferences">
<ItemGroup>
<PackageReference Remove="Microsoft.AspNetCore.Components.Web" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0" />
</ItemGroup>
</Target>
</Project>
29 changes: 4 additions & 25 deletions src/components/BootstrapBlazor.ImageCropper/ImageCropper.razor
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
@namespace BootstrapBlazor.Components
@inherits BootstrapModuleComponentBase
@attribute [JSModuleAutoLoader("./_content/BootstrapBlazor.ImageCropper/ImageCropper.razor.js")]

<link href="@CssPath" rel="stylesheet">

<div @ref="Element">

<div class="containerTop">
<div>
<img class="@CssClass" data-action="image" src="@Url" alt="Picture">
</div>
@if (DefaultButton)
{
<div class="input-group">
<button type="button" onclick="@(() => Crop())" class="btn btn-primary">@ConfirmBtnTitle</button>
<button type="button" onclick="@(() => Reset())" class="btn btn-primary">@ResetBtnTitle</button>
</div>
}
@if (Preview)
{
<h3>@PreviewTitle</h3>
<div data-action="result"></div>
}


</div>

<div @attributes="@AdditionalAttributes" class="@ClassString" id="@Id">
<img src="@Url" class="bb-cropper-image" />
</div>

Loading

0 comments on commit 66608b5

Please sign in to comment.