-
-
Notifications
You must be signed in to change notification settings - Fork 363
feat(ImageCropper): add OnCropChangedAsync parameter #6179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR adds an OnCropChangedAsync callback to the ImageCropper component and extends the sample page to capture and display live crop parameters by updating both the Razor markup and its code-behind logic. Sequence Diagram for OnCropChangedAsync Callback and Data DisplaysequenceDiagram
actor User
participant ImageCropperComponent
participant ImageCroppersPage
User->>ImageCropperComponent: Modifies crop selection (e.g., drag, resize)
ImageCropperComponent->>ImageCroppersPage: OnCropChangedAsync(cropData: ImageCropperData)
activate ImageCroppersPage
ImageCroppersPage->>ImageCroppersPage: _data = cropData
ImageCroppersPage->>ImageCroppersPage: Calls StateHasChanged()
ImageCroppersPage-->>User: Displays updated crop data (X, Y, Width, Height, Rotate, ScaleX, ScaleY)
deactivate ImageCroppersPage
Updated Class Diagram for ImageCroppers Page and Related ComponentsclassDiagram
class ImageCropper {
+string Url
+object Options
+Func~ImageCropperData, Task~ OnCropChangedAsync
+Task Rotate(int degrees)
+Task CropAsync()
%% Other methods and parameters relevant to ImageCropper
}
class ImageCroppers {
-ImageCropper _cropper
-ImageCropperData _data
-string[] _images
-object _roundOptions1
-string _base64String
+Task OnCropChangedAsync(ImageCropperData data) // New method
+Task Crop()
+Task RoundCrop()
+Task Rotate()
#Task OnInitializedAsync()
}
class ImageCropperData {
+double X
+double Y
+double Width
+double Height
+double Rotate
+double ScaleX
+double ScaleY
}
ImageCroppers o-- "1" ImageCropper : uses
ImageCroppers o-- "1" ImageCropperData : holds instance (_data)
ImageCropper ..> ImageCropperData : OnCropChangedAsync callback uses
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ArgoZhang - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| <BootstrapInputGroupLabel DisplayText="deg"></BootstrapInputGroupLabel> | ||
| </BootstrapInputGroup> | ||
| </div> | ||
| <div class="col-12 col-sm-6 d-none d-sm-flex"> |
There was a problem hiding this comment.
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
|
|
||
| private Task Rotate() => _cropper.Rotate(90); | ||
|
|
||
| private ImageCropperData _data = new(); |
There was a problem hiding this comment.
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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6179 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 704 704
Lines 31099 31099
Branches 4394 4394
=========================================
Hits 31099 31099
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #6178
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add an asynchronous OnCropChanged callback to the ImageCropper component and enhance the sample to display live crop data.
New Features:
Enhancements: