From 823489baedf5f18ec7f170324bfda04edacd6bf3 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Fri, 20 May 2016 06:42:32 -0400 Subject: [PATCH] Fix rounding error causing progress bar to grow and shrink 1px --- js/page/my_files.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/page/my_files.js b/js/page/my_files.js index 02ec58b94..5b258fd93 100644 --- a/js/page/my_files.js +++ b/js/page/my_files.js @@ -38,6 +38,8 @@ var MyFilesRow = React.createClass({ } }, render: function() { + var progressBarWidth = 230; // Move this somewhere better + if (this.props.completed) { var pauseLink = null; var curProgressBarStyle = {display: 'none'}; @@ -47,12 +49,12 @@ var MyFilesRow = React.createClass({ onClick={() => { this.onPauseResumeClicked() }} />; var curProgressBarStyle = Object.assign({}, progressBarStyle); - curProgressBarStyle.width = this.props.ratioLoaded * 230; - curProgressBarStyle.borderRightWidth = 230 - (this.props.ratioLoaded * 230) + 2; + curProgressBarStyle.width = Math.floor(this.props.ratioLoaded * progressBarWidth) + 'px'; + curProgressBarStyle.borderRightWidth = progressBarWidth - Math.ceil(this.props.ratioLoaded * progressBarWidth) + 2; } if (this.props.showWatchButton) { - var watchButton = + var watchButton = } else { var watchButton = null; }