-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Code Quality: Added StorageBar and StorageRing Controls #16001
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
|
A final round of cleaning up or adding comments to parts of the controls can be done soon, but I wanted to get the functional code in after working on it on and off outside of the repo and adding it to the repo over the past week or so |
This is done now |
5acc4c7 to
8b3ab77
Compare
| /// <summary> | ||
| /// Updates the RingShape path | ||
| /// </summary> | ||
| private void UpdatePath() |
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.
This method should be split into multiple smaller functions. Also, I think the comment is kind of redundant and can be left out.
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 am breaking this up into smaller functions and updated comments
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 think now is good?
| var result = number % divider; | ||
|
|
||
| // Ensure the result is positive or zero | ||
| result = result < 0 ? result + divider : result; |
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.
Technically, this only works if number > -divider
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.
@0x5bfa How do you suggest I change the method to ensure it works correctly?
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.
If you're ensuring it be positive or zero, can't it be 'result < 0 ? 0 : result'?
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.
What kind of modulus is this?
30650a1 to
9bc64c2
Compare
9bc64c2 to
5b8b66d
Compare
Resolving suggestions made by Marcel in code review
Resolved / Related Issues
This adds StorageBar and StorageRing controls to the Files.App.Controls project for future use, as well as a test page in the UITests app for testing behaviour.
I am no expert when it comes to coding let alone making Controls, so I would appreciate these be given a thorough review to ensure there are no edge cases I have not anticipated, as well as general changes to improve the code by those with the expertise and experience. I will call out @yaira2 and @0x5bfa who have been seeing my progress via Discord as I was working on them. But also anyone with control and or mathematics experience who can ensure I am using the most optimal calculations for the angles and size calculations. @marcelwgn has contributed to the Community Toolkit so will be able to make some comments on my properties and general code quality.
I also want to indicate I took great inspiration from the RadialGuage control in the Toolkit, as well as the blogposts and sample code from Diederik Krols and his blog posts.
As well as Co-Pilot for maths queries and interpolation code suggestions, here are other posts I found helpful