-
Notifications
You must be signed in to change notification settings - Fork 524
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
Fix/issue 895 #1118
Fix/issue 895 #1118
Conversation
Ack, I forgot to run the formatter before I pushed. I'll push again later. |
package.json
Outdated
"sideEffects": false | ||
"sideEffects": false, | ||
"dependencies": { | ||
"circle2": "^1.1.1" |
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 would really prefer not to take this dependency. Can you get it done without?
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 can give it a try! Do you have some general guidelines on whether or not to take a dependency, like a best practices guide? I didn't see anything about that in the formidable-playbook
.
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.
Assuming we did want this dep, isn't it supposed to be in https://github.com/FormidableLabs/victory/blob/master/packages/victory-bar/package.json ?
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.
Yes, keeping it in the main package.json would add it to every package.
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.
Thanks for pointing that out! I'll uninstall it from the main package.json.
packages/victory-bar/src/bar.js
Outdated
const topRightArc = `A ${topArc}, ${intrxnRight.x}, ${intrxnRight.y}`; | ||
const bottomRightArc = `A ${bottomArc}, ${x1 - cornerRadius.bottom}, ${y0}`; | ||
const end = "z"; | ||
// There are four ways the verticalBarPath can self-intersect |
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.
*three ways
Do Not Merge! Just pushing to get feedback. I removed the circle2 dependency with my own circle module and wrote tests for that module. I am considering some changes to make
I ready though the testing section of |
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.
There are a lot of repeated patterns in your three cases that I think can be refactored into small reusable functions. You can make this a lot shorter by only re-assigning variables that are different in the three cases. Ternary operators might help, too.
Makes sense to me 👍Thanks for the feedback. |
this.x = x; | ||
this.y = y; | ||
} | ||
const Point = function (x, y) { |
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.
Writing function Point(x, y)
results in ESLint error func-style
Writing const Point = function (x, y)
results in ESLint error no-invalid-this
Which is preferred?
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.
const Point = (x, y) => ...
should pass our linting rules. Otherwise, prefer function Point(x, y)
and add an exception for func-style
@boygirl Would I be a good idea to solve issue #1119 in this PR/branch as well? It would be kinda strange to solve issue #895, and then immediately edit the same code to solve #1119. Let me know what you think of changes, and if it looks good to you, I can apply the fix to horizontal bars and solve #1119. |
@narinluangrath yes, I agree those changes make sense together. |
@narinluangrath to clarify, yes, please do add #1119 into this ticket. I also think it makes sense to move these path calculations into a separate file since they're getting so lengthy. Maybe |
- Translate code from getVerticalBarPath to horizontal case - Add Circle.ProtoType.solveY helper method
- Allow topLeft, topRight, bottomLeft, bottomRight fields - Still need to make it functional
- modify getCornerRadius helper function to look for topLeft, topRight (not just top) - create helper function getVerticalBarPoints to make getVerticalBarPath function smaller - add temporary solution for getHorizontalBarPath and getPolarBarPath (see TODO)
Going to push fix after work today! Code is done, just need to pass linting rules. |
- Add temporary solution for getVerticalPolarBar since it normally doesn't accept topLeft, topRight, etc. - Change cornerRadius function to satisfy linter - Try to change getVerticalBarPoints to satisfy linter
Gurrr merge conflict. I probably should have seen this coming, since most of the conflict is caused by my own code from a previously merged PR ... going to rebase and try again. |
@narinluangrath closing this one in favor of #1158 |
What's new:
Other comments: