@@ -240,6 +240,16 @@ Graphics.setLoadingImage = function(src) {
240240 this . _loadingImage . src = src ;
241241} ;
242242
243+ /**
244+ * Sets whether the progress bar is enabled.
245+ *
246+ * @static
247+ * @method setEnableProgress
248+ */
249+ Graphics . setProgressEnabled = function ( enable ) {
250+ this . _progressEnabled = enable ;
251+ } ;
252+
243253/**
244254 * Initializes the counter for displaying the "Now Loading" image.
245255 *
@@ -260,30 +270,43 @@ Graphics._setupProgress = function(){
260270 this . _progressElement = document . createElement ( 'div' ) ;
261271 this . _progressElement . id = 'loading-progress' ;
262272 this . _progressElement . width = 600 ;
263- this . _progressElement . height = 30 ;
264- this . _progressElement . style . background = 'linear-gradient(to top, gray, lightgray)' ;
265- this . _progressElement . style . border = '5px solid white' ;
266- this . _progressElement . style . borderRadius = '15px' ;
273+ this . _progressElement . height = 300 ;
274+ this . _progressElement . style . visibility = 'hidden' ;
267275
268276 this . _barElement = document . createElement ( 'div' ) ;
269277 this . _barElement . id = 'loading-bar' ;
270- this . _barElement . style . width = '0%' ;
271- this . _barElement . style . height = '100%' ;
272- this . _barElement . style . background = 'linear-gradient(to top, lime, palegreen)' ;
273- this . _barElement . style . borderRadius = '10px' ;
278+ this . _barElement . style . width = '100%' ;
279+ this . _barElement . style . height = '10%' ;
280+ this . _barElement . style . background = 'linear-gradient(to top, gray, lightgray)' ;
281+ this . _barElement . style . border = '5px solid white' ;
282+ this . _barElement . style . borderRadius = '15px' ;
283+ this . _barElement . style . marginTop = '40%' ;
284+
285+ this . _filledBarElement = document . createElement ( 'div' ) ;
286+ this . _filledBarElement . id = 'loading-filled-bar' ;
287+ this . _filledBarElement . style . width = '0%' ;
288+ this . _filledBarElement . style . height = '100%' ;
289+ this . _filledBarElement . style . background = 'linear-gradient(to top, lime, honeydew)' ;
290+ this . _filledBarElement . style . borderRadius = '10px' ;
274291
275292 this . _progressElement . appendChild ( this . _barElement ) ;
293+ this . _barElement . appendChild ( this . _filledBarElement ) ;
294+ this . _updateProgress ( ) ;
276295
277296 document . body . appendChild ( this . _progressElement ) ;
278297} ;
279298
280299Graphics . _showProgress = function ( ) {
281- this . _progressElement . value = 0 ;
282- this . _progressElement . style . visibility = 'visible' ;
300+ if ( this . _progressEnabled ) {
301+ this . _progressElement . value = 0 ;
302+ this . _progressElement . style . visibility = 'visible' ;
303+ this . _progressElement . style . zIndex = 98 ;
304+ }
283305} ;
284306
285307Graphics . _hideProgress = function ( ) {
286308 this . _progressElement . style . visibility = 'hidden' ;
309+ clearTimeout ( this . _progressTimeout ) ;
287310} ;
288311
289312Graphics . _updateProgressCount = function ( countLoaded , countLoading ) {
@@ -294,13 +317,11 @@ Graphics._updateProgressCount = function(countLoaded, countLoading){
294317 progressValue = 100 ;
295318 }
296319
297- this . _barElement . style . width = progressValue + '%' ;
320+ this . _filledBarElement . style . width = progressValue + '%' ;
298321} ;
299322
300323Graphics . _updateProgress = function ( ) {
301- this . _progressElement . style . zIndex = 99 ;
302324 this . _centerElement ( this . _progressElement ) ;
303- this . _progressElement . style . marginTop = 450 * this . _realScale + 'px' ;
304325} ;
305326
306327/**
@@ -326,7 +347,6 @@ Graphics.endLoading = function() {
326347 this . _clearUpperCanvas ( ) ;
327348 this . _upperCanvas . style . opacity = 0 ;
328349 this . _hideProgress ( ) ;
329- clearTimeout ( this . _progressTimeout ) ;
330350} ;
331351
332352/**
@@ -380,6 +400,7 @@ Graphics.eraseLoadingError = function() {
380400 */
381401Graphics . printError = function ( name , message ) {
382402 this . _errorShowed = true ;
403+ this . _hideProgress ( ) ;
383404 this . hideFps ( ) ;
384405 if ( this . _errorPrinter ) {
385406 this . _updateErrorPrinter ( ) ;
0 commit comments