Fix rounding error causing progress bar to grow and shrink 1px

This commit is contained in:
Alex Liebowitz 2016-05-20 06:42:32 -04:00
parent 6db7551911
commit 823489baed

View file

@ -38,6 +38,8 @@ var MyFilesRow = React.createClass({
} }
}, },
render: function() { render: function() {
var progressBarWidth = 230; // Move this somewhere better
if (this.props.completed) { if (this.props.completed) {
var pauseLink = null; var pauseLink = null;
var curProgressBarStyle = {display: 'none'}; var curProgressBarStyle = {display: 'none'};
@ -47,12 +49,12 @@ var MyFilesRow = React.createClass({
onClick={() => { this.onPauseResumeClicked() }} />; onClick={() => { this.onPauseResumeClicked() }} />;
var curProgressBarStyle = Object.assign({}, progressBarStyle); var curProgressBarStyle = Object.assign({}, progressBarStyle);
curProgressBarStyle.width = this.props.ratioLoaded * 230; curProgressBarStyle.width = Math.floor(this.props.ratioLoaded * progressBarWidth) + 'px';
curProgressBarStyle.borderRightWidth = 230 - (this.props.ratioLoaded * 230) + 2; curProgressBarStyle.borderRightWidth = progressBarWidth - Math.ceil(this.props.ratioLoaded * progressBarWidth) + 2;
} }
if (this.props.showWatchButton) { if (this.props.showWatchButton) {
var watchButton = <WatchLink streamName={this.props.lbryUri} button='primary' /> var watchButton = <WatchLink streamName={this.props.lbryUri} />
} else { } else {
var watchButton = null; var watchButton = null;
} }