-
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
New SizeExtensions for Windows.Foundation.Size #3489
Conversation
Thanks Sergio0694 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.
I like these extensions, should help make code a little more explicit.
Hey Sergio, thanks for picking this up! Couple of quick comments:
|
@azchohfi I'm seeing lots of CI failures due to "using directives not being sorted alphabetically", although they're from files I've personally not touched, and that apparently have never caused issues before. Also weird that the CI here is only failing after I've merged changes from I can just fix that here so it's not a problem, but I was wondering whether these errors were due to some change in a StyleCop file or something else? Because I don't remember seeing these errors in the CI before, nor in my other branches so far 🤔 |
Hello @Sergio0694! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Hey @Sergio0694. I don't think that was a merge error. If you look at the full changes, those using directives were added by this PR, as they didn't exist on master before (for example: https://github.com/windows-toolkit/WindowsCommunityToolkit/pull/3489/files#diff-bd1fa812b1287e89ed50575105beb967). |
@azchohfi You're absolutely right, I think I just got confused by the |
@@ -460,7 +460,7 @@ private void UpdateMaskArea(bool animate = false) | |||
case CropShape.Rectangular: | |||
if (_innerGeometry is RectangleGeometry rectangleGeometry) | |||
{ | |||
var to = new Rect(new Point(_startX, _startY), new Point(_endX, _endY)); | |||
var to = new Point(_startX, _startY).ToRect(new Point(_endX, _endY)); |
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.
@Sergio0694 noticed in this case we don't have a way to construct a rect from x, y, x2, y2. Would it be useful for us to create a helper for this scenario too and avoid creating both two new points just to create a Rect? This pattern is used 3 times in the other file as well. Thoughts?
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.
@michael-hawker That would be the ideal use case for static extension methods 😢
As in, ideally we'd just add a Rect.FromCoordinates
static method taking x1
, y1
, x2
, x2
.
Withough that (C# doesn't support that yet unfortunately), not sure about this - I mean we could add a RectHelper
class with that method, but having a whole new helper class just for that single method might be a bit overkill 🤔
If you like that idea just let me know and I can create another PR with that though!
Closes #3317
PR Type
What kind of change does this PR introduce?
What is the new behavior?
This PR adds new extensions to easily convert
Windows.Foundation.Size
andPoint
values toRect
:PR Checklist
Please check if your PR fulfills the following requirements:
Pull Request has been submitted to the documentation repository instructions. Link:Sample in sample app has been added / updated (for bug fixes / features)Icon has been created (if new sample) following the Thumbnail Style Guide and templates