-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add CroppedRegionChanged event for ImageCropper. #3179
Add CroppedRegionChanged event for ImageCropper. #3179
Conversation
Thanks HHChaos for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌 |
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.
It looks like there are inconsistencies to when this event fires. Initially, it only fires after moving the thumb and letting go of the mouse a single time, but if you then drag the image around it fires constantly as the image is moving. It looks like there are discrepancies between when the CroppedRegion
property is updated during ManipulationDeltas vs. ManipulationCompleteds between the image and the thumbs.
It feels like there should there be two events, one which occurs as the region is changing do to the deltas, and another when the manipulations are completed? We could call them CropRegionManipulationDelta
that's fired constantly as the thumbs or image are moving vs. CropRegionManipulationCompleted
which fires only after a thumb or image manipulation with the mouse has finished?
We of course also need to document these behaviors and add an event section to the documentation here.
Thanks!
Microsoft.Toolkit.Uwp.UI.Controls/ImageCropper/ImageCropperCroppedRegionChangedEventArgs.cs
Outdated
Show resolved
Hide resolved
…ppedRegionChangedEventArgs.cs Co-Authored-By: Michael Hawker MSFT (XAML Llama) <[email protected]>
This PR has been marked as "needs attention 👋" and awaiting a response from the team. |
Co-Authored-By: Michael Hawker MSFT (XAML Llama) <[email protected]>
This is because dragging the thumb does not necessarily cause the CroppedRegion to change, although it seems that the CroppedRegion has changed. CroppedRegion only changes when the image is moved or zoomed (it can be understood that a change in the viewport will cause a CroppedRegion change). I want to know what you think about this. Is it acceptable? |
@HHChaos yeah I understand the rationale of the current implementation. I'm just commenting from actually playing with the event from the development side, it doesn't seem as useful when the two scenarios (resizing area vs. changing image size/pos) behave differently. I feel like based on the events we do have, it shouldn't be too hard to split apart into two sets of events for when there's any change vs. when it's completed? I'm pretty sure this'll help developers in different scenarios too when they're providing immediate feedback on the cropped region's size with the delta or having to perform another step after the user's finished their manipulation. From looking at the code in |
@HHChaos also, if it helps, I did this initial review all on a live stream starting here. We jump to another PR for a bit while the app compiles, but you can see me testing the scenario out first-hand live here and discussing with some other community members about separating these concerns. |
namespace Microsoft.Toolkit.Uwp.UI.Controls | ||
{ | ||
/// <summary> | ||
///为< 请参阅cref = “ ImageCropper.CroppedRegionChanged ” />事件提供事件数据。 |
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.
Looks like something happened with GitHub accepting the comment? This is causing the CI to fail as it's not a valid XML doc comment anymore.
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.
It seems that github accepted the changes that were automatically translated by Google Translate (because my chrome automatically translated the webpage into Chinese), maybe it should be a github bug? 🤣
Let me fix it.
@michael-hawker Yes, I think you are right. I will make some changes. |
Fixes #3163
PR Type
What kind of change does this PR introduce?
What is the current behavior?
What is the new behavior?
PR Checklist
Please check if your PR fulfills the following requirements:x
Other information