From 4c700e9c0f0e6cf2583314dcffa7ef844355ef3b Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 22 May 2014 10:43:52 -0500 Subject: [PATCH] fix(backdrop): Changed z-index for loading backdrop only. Fixes #1428 --- js/angular/service/backdrop.js | 11 ++++++++++- js/angular/service/loading.js | 2 +- scss/_variables.scss | 6 +++--- test/unit/angular/service/loading.unit.js | 8 ++++++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/js/angular/service/backdrop.js b/js/angular/service/backdrop.js index e20f31d7cb7..6a971a0fb58 100644 --- a/js/angular/service/backdrop.js +++ b/js/angular/service/backdrop.js @@ -39,6 +39,7 @@ function($document) { var el = jqLite('
'); var backdropHolds = 0; + var backdropExtraClasses = null; $document[0].body.appendChild(el[0]); @@ -60,13 +61,19 @@ function($document) { _element: el }; - function retain() { + function retain(extraClasses) { + backdropExtraClasses = extraClasses; + if ( (++backdropHolds) === 1 ) { el.addClass('visible'); ionic.requestAnimationFrame(function() { backdropHolds && el.addClass('active'); }); } + if(extraClasses) { + console.log('Adding', extraClasses); + el.addClass(extraClasses); + } } function release() { if ( (--backdropHolds) === 0 ) { @@ -75,5 +82,7 @@ function($document) { !backdropHolds && el.removeClass('visible'); }, 100); } + el.removeClass(backdropExtraClasses); + backdropExtraClasses = null; } }]); diff --git a/js/angular/service/loading.js b/js/angular/service/loading.js index 40f4b012940..fd58c3155ed 100644 --- a/js/angular/service/loading.js +++ b/js/angular/service/loading.js @@ -141,7 +141,7 @@ function($document, $ionicTemplateLoader, $ionicBackdrop, $timeout, $q, $log, $c //options.showBackdrop: deprecated this.hasBackdrop = !options.noBackdrop && options.showBackdrop !== false; if (this.hasBackdrop) { - $ionicBackdrop.retain(); + $ionicBackdrop.retain('backdrop-loading'); } } diff --git a/scss/_variables.scss b/scss/_variables.scss index 47878145f96..b35043defcc 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -651,7 +651,7 @@ $badge-default-text: #AAAAAA !default; $z-index-action-sheet: 11 !default; $z-index-badge: 1 !default; -$z-index-backdrop: 10 !default; +$z-index-backdrop: 11 !default; $z-index-bar: 10 !default; $z-index-bar-title: 0 !default; $z-index-bar-button: 1 !default; @@ -663,11 +663,11 @@ $z-index-item-options: 1 !default; $z-index-item-radio: 3 !default; $z-index-item-reordering: 9 !default; $z-index-item-toggle: 3 !default; -$z-index-loading: 11 !default; +$z-index-loading: 13 !default; $z-index-menu: 0 !default; $z-index-modal: 10 !default; $z-index-pane: 1 !default; -$z-index-popup: 11 !default; +$z-index-popup: 12 !default; $z-index-scroll-bar: 9999 !default; $z-index-slider-pager: 1 !default; $z-index-tabs: 5 !default; diff --git a/test/unit/angular/service/loading.unit.js b/test/unit/angular/service/loading.unit.js index 2664a45ec42..ea5561d6be5 100644 --- a/test/unit/angular/service/loading.unit.js +++ b/test/unit/angular/service/loading.unit.js @@ -70,6 +70,14 @@ describe('$ionicLoading service', function() { expect(loader.element.text()).toBe('1 content'); })); + it('should add and remove backdrop-loading to backdrop', inject(function($ionicLoading, $ionicBackdrop) { + var loader = TestUtil.unwrapPromise($ionicLoading._getLoader()); + loader.show({ templateUrl: 'template.html' }); + expect($ionicBackdrop._element.hasClass('backdrop-loading')).toBe(true); + loader.hide(); + expect($ionicBackdrop._element.hasClass('backdrop-loading')).toBe(false); + })); + }); describe('.hide()', function() {