update components

This commit is contained in:
Luke Pulverenti 2016-01-29 21:43:11 -05:00
parent b4ae58347b
commit d90d4de2b0
42 changed files with 1514 additions and 361 deletions

View file

@ -85,13 +85,18 @@ Custom property | Description | Default
},
listeners: {
'transitionend' : '_onTransitionend'
},
/**
* Appends the backdrop to document body and sets its `z-index` to be below the latest overlay.
*/
prepare: function() {
// Always update z-index
this.style.zIndex = this._manager.backdropZ();
if (!this.parentNode) {
Polymer.dom(document.body).appendChild(this);
this.style.zIndex = this._manager.currentOverlayZ() - 1;
}
},
@ -109,9 +114,14 @@ Custom property | Description | Default
* Hides the backdrop if needed.
*/
close: function() {
// only need to make the backdrop invisible if this is called by the last overlay with a backdrop
if (this._manager.getBackdrops().length < 2) {
// Always update z-index
this.style.zIndex = this._manager.backdropZ();
// close only if no element with backdrop is left
if (this._manager.getBackdrops().length === 0) {
this._setOpened(false);
// complete() will be called after the transition is done.
// If animations are disabled via custom-styles, user is expected to call
// complete() after close()
}
},
@ -123,6 +133,12 @@ Custom property | Description | Default
if (this._manager.getBackdrops().length === 0 && this.parentNode) {
Polymer.dom(this.parentNode).removeChild(this);
}
},
_onTransitionend: function (event) {
if (event && event.target === this) {
this.complete();
}
}
});