From b65b7d95e79a2d01b1bf086fb4314d85e7b146c0 Mon Sep 17 00:00:00 2001 From: WhiteTreePaladin Date: Tue, 13 Sep 2011 12:24:13 +0000 Subject: [PATCH] Make the progress bar finish early so that the user can actually see it finish. Display percent progress rather than details. This was SVN commit r10272. --- .../data/mods/public/gui/loading/loading.js | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/binaries/data/mods/public/gui/loading/loading.js b/binaries/data/mods/public/gui/loading/loading.js index ed7caeea40..8ca31919af 100644 --- a/binaries/data/mods/public/gui/loading/loading.js +++ b/binaries/data/mods/public/gui/loading/loading.js @@ -1,4 +1,5 @@ var g_Data; +const END_PIECE_WIDTH = 16; function init(data) { @@ -69,22 +70,30 @@ function init(data) // ==================================================================== function displayProgress() { - const END_PIECE_WIDTH = 16; + // Make the progessbar finish a little early so that the user can actually see it finish + if (g_Progress < 100) + { + // Show 100 when it is really 99 + var progress = g_Progress + 1; - getGUIObjectByName("progressbar").caption = g_Progress; // display current progress - getGUIObjectByName("progressText").caption = g_LoadDescription; // display current progess details + getGUIObjectByName("progressbar").caption = progress; // display current progress + getGUIObjectByName("progressText").caption = progress + "%"; - // Keep curved right edge of progress bar in sync with the rest of the progress bar - var middle = getGUIObjectByName("progressbar"); - var rightSide = getGUIObjectByName("progressbar_right"); + // Displays detailed loading info rather than a percent + // getGUIObjectByName("progressText").caption = g_LoadDescription; // display current progess details - var middleLength = (middle.size.right - middle.size.left) - (END_PIECE_WIDTH / 2); - var increment = Math.round(g_Progress*middleLength/100); + // Keep curved right edge of progress bar in sync with the rest of the progress bar + var middle = getGUIObjectByName("progressbar"); + var rightSide = getGUIObjectByName("progressbar_right"); - var size = rightSide.size; - size.left = increment; - size.right = increment + END_PIECE_WIDTH; - rightSide.size = size; + var middleLength = (middle.size.right - middle.size.left) - (END_PIECE_WIDTH / 2); + var increment = Math.round(progress * middleLength / 100); + + var size = rightSide.size; + size.left = increment; + size.right = increment + END_PIECE_WIDTH; + rightSide.size = size; + } } // ====================================================================