| OLD | NEW |
| 1 (function() { | 1 (function() { |
| 2 | 2 |
| 3 Polymer({ | 3 Polymer({ |
| 4 | 4 |
| 5 is: 'iron-overlay-backdrop', | 5 is: 'iron-overlay-backdrop', |
| 6 | 6 |
| 7 properties: { | 7 properties: { |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Returns true if the backdrop is opened. | 10 * Returns true if the backdrop is opened. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 }, | 24 }, |
| 25 | 25 |
| 26 listeners: { | 26 listeners: { |
| 27 'transitionend' : '_onTransitionend' | 27 'transitionend' : '_onTransitionend' |
| 28 }, | 28 }, |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Appends the backdrop to document body and sets its `z-index` to be below
the latest overlay. | 31 * Appends the backdrop to document body and sets its `z-index` to be below
the latest overlay. |
| 32 */ | 32 */ |
| 33 prepare: function() { | 33 prepare: function() { |
| 34 // Always update z-index | |
| 35 this.style.zIndex = this._manager.backdropZ(); | |
| 36 if (!this.parentNode) { | 34 if (!this.parentNode) { |
| 37 Polymer.dom(document.body).appendChild(this); | 35 Polymer.dom(document.body).appendChild(this); |
| 38 } | 36 } |
| 39 }, | 37 }, |
| 40 | 38 |
| 41 /** | 39 /** |
| 42 * Shows the backdrop if needed. | 40 * Shows the backdrop if needed. |
| 43 */ | 41 */ |
| 44 open: function() { | 42 open: function() { |
| 45 // only need to make the backdrop visible if this is called by the first o
verlay with a backdrop | 43 // only need to make the backdrop visible if this is called by the first o
verlay with a backdrop |
| 46 if (this._manager.getBackdrops().length < 2) { | 44 if (this._manager.getBackdrops().length < 2) { |
| 47 this._setOpened(true); | 45 this._setOpened(true); |
| 48 } | 46 } |
| 49 }, | 47 }, |
| 50 | 48 |
| 51 /** | 49 /** |
| 52 * Hides the backdrop if needed. | 50 * Hides the backdrop if needed. |
| 53 */ | 51 */ |
| 54 close: function() { | 52 close: function() { |
| 55 // Always update z-index | |
| 56 this.style.zIndex = this._manager.backdropZ(); | |
| 57 // close only if no element with backdrop is left | 53 // close only if no element with backdrop is left |
| 58 if (this._manager.getBackdrops().length === 0) { | 54 if (this._manager.getBackdrops().length === 0) { |
| 59 // Read style before setting opened. | 55 // Read style before setting opened. |
| 60 var cs = getComputedStyle(this); | 56 var cs = getComputedStyle(this); |
| 61 var noAnimation = (cs.transitionDuration === '0s' || cs.opacity == 0); | 57 var noAnimation = (cs.transitionDuration === '0s' || cs.opacity == 0); |
| 62 this._setOpened(false); | 58 this._setOpened(false); |
| 63 // In case of no animations, complete | 59 // In case of no animations, complete |
| 64 if (noAnimation) { | 60 if (noAnimation) { |
| 65 this.complete(); | 61 this.complete(); |
| 66 } | 62 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 | 75 |
| 80 _onTransitionend: function (event) { | 76 _onTransitionend: function (event) { |
| 81 if (event && event.target === this) { | 77 if (event && event.target === this) { |
| 82 this.complete(); | 78 this.complete(); |
| 83 } | 79 } |
| 84 } | 80 } |
| 85 | 81 |
| 86 }); | 82 }); |
| 87 | 83 |
| 88 })(); | 84 })(); |
| OLD | NEW |