Skip to content

Commit

Permalink
Compute the correct number of pixels to shave off of bar width
Browse files Browse the repository at this point in the history
  • Loading branch information
DingoEatingFuzz committed Jul 12, 2018
1 parent 9dd49ed commit ddd40cb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ui/app/components/distribution-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ export default Component.extend(WindowResizable, {

this.set('slices', slices);

const setWidth = d => `${width * d.percent - (d.index === sliceCount - 1 || d.index === 0 ? 1 : 2)}px`;
const setWidth = d => {
// 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

return `${width * d.percent - modifier}px`;
};
const setOffset = d => `${width * d.offset + (d.index === 0 ? 0 : 1)}px`;

let hoverTargets = slices.selectAll('.target').data(d => [d]);
Expand Down

0 comments on commit ddd40cb

Please sign in to comment.