fix(loading): stop resize flicker when showing & changing text

This commit is contained in:
Andrew
2014-07-18 15:45:29 -06:00
parent 81a7342fc7
commit cb36869889
2 changed files with 31 additions and 22 deletions

View File

@@ -1,6 +1,8 @@
var LOADING_TPL =
'<div class="loading">' +
'<div class="loading-container">' +
'<div class="loading">' +
'</div>' +
'</div>';
var LOADING_HIDE_DEPRECATED = '$ionicLoading instance.hide() has been deprecated. Use $ionicLoading.hide().';
@@ -109,17 +111,16 @@ function($document, $ionicTemplateLoader, $ionicBackdrop, $timeout, $q, $log, $c
templatePromise.then(function(html) {
if (html) {
self.element.html(html);
$compile(self.element.contents())(self.scope);
var loading = self.element.children();
loading.html(html);
$compile(loading.contents())(self.scope);
}
//Don't show until template changes
if (self.isShown) {
self.element.addClass('visible');
ionic.DomUtil.centerElementByMarginTwice(self.element[0]);
ionic.requestAnimationFrame(function() {
self.isShown && self.element.addClass('active');
ionic.DomUtil.centerElementByMarginTwice(self.element[0]);
$document[0].body.classList.add('loading-active');
});
}

View File

@@ -4,9 +4,20 @@
* --------------------------------------------------
*/
.loading {
@include transition(0.2s opacity linear);
.loading-container {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: $z-index-loading;
@include display-flex();
@include justify-content(center);
@include align-items(center);
@include transition(0.2s opacity linear);
visibility: hidden;
opacity: 0;
@@ -17,23 +28,20 @@
opacity: 1;
}
position: fixed;
top: 50%;
left: 50%;
.loading {
padding: $loading-padding;
z-index: $z-index-loading;
padding: $loading-padding;
border-radius: $loading-border-radius;
background-color: $loading-bg-color;
border-radius: $loading-border-radius;
background-color: $loading-bg-color;
color: $loading-text-color;
text-align: center;
text-overflow: ellipsis;
font-size: $loading-font-size;
h1, h2, h3, h4, h5, h6 {
color: $loading-text-color;
text-align: center;
text-overflow: ellipsis;
font-size: $loading-font-size;
h1, h2, h3, h4, h5, h6 {
color: $loading-text-color;
}
}
}