-
Notifications
You must be signed in to change notification settings - Fork 2k
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
UI: Fix the missing pixels issue with distribution-bar #4507
Conversation
@@ -76,6 +76,9 @@ export default Component.extend(WindowResizable, { | |||
const { chart, _data, isNarrow } = this.getProperties('chart', '_data', 'isNarrow'); | |||
const width = this.$('svg').width(); | |||
const filteredData = _data.filter(d => d.value > 0); | |||
filteredData.forEach((d, index) => { |
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 read a thing about preference of for ... of
over forEach
loops recently and have been trying to use them more. I certainly like they way they read, though that's not necessarily true of the transpiled code.
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 always forget that JS has better for loops now.
// Remove a pixel from either side of the slice | ||
let modifier = 2; | ||
if (d.index === 0) modifier--; // But not the left side | ||
if (d.index === sliceCount - 1) modifier--; // But not the right side |
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.
These three lines are clever (in a good way).
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.
Nice improvement - I never knew they weren't square corners!
ddd40cb
to
d5af5e6
Compare
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
These two pixels have been a thorn in my side for a long time.
This fixes two bugs that amount to the same missing pixel issue:
Here are some very subtle before and after screenshots:
Bug 1: A missing pixel on the right side due to wrong indices
before
after
Bug 2: A missing pixel on either side due to subtracting only 1 instead of 2.
before
after