diff --git a/extensions/cornerstone/src/components/DicomUpload/DicomUploadProgress.tsx b/extensions/cornerstone/src/components/DicomUpload/DicomUploadProgress.tsx index 1b7fe89b8..e1de213a6 100644 --- a/extensions/cornerstone/src/components/DicomUpload/DicomUploadProgress.tsx +++ b/extensions/cornerstone/src/components/DicomUpload/DicomUploadProgress.tsx @@ -259,22 +259,24 @@ function DicomUploadProgress({ }, [getPercentCompleteRounded, percentComplete]); /** - * Gets the css style for the 'n of m' (files completed) text. The only css attribute - * of the style is width such that the 'n of m' is always a fixed width and thus - * as each file completes uploading the text on screen does not constantly shift - * left and right. + * Gets the CSS style for the 'n of m' (files completed) text. + * The width changes according to numFilesCompleted and can vary, + * e.g. "1 of 200", "10 of 200", "100 of 200" all have differents width. */ const getNofMFilesStyle = useCallback(() => { // the number of digits accounts for the digits being on each side of the ' of ' - const numDigits = 2 * dicomFileUploaderArr.length.toString().length; - // the number of digits + 2 spaces and 2 characters for ' of ' - const numChars = numDigits + 4; + const numDigits = + numFilesCompleted.toString().length + dicomFileUploaderArr.length.toString().length; + // The number of digits + 3 additional characters (accounts for ' of '). + // Even though intuitively 4 should be better, this is the most accurate width. + // The font may play a part in this discrepancy. + const numChars = numDigits + 3; return { width: `${numChars}ch` }; - }, []); + }, [numFilesCompleted]); const getNumCompletedAndTimeRemainingComponent = (): ReactElement => { return ( -