| OLD | NEW |
| 1 (function() { | 1 (function() { |
| 2 | 2 |
| 3 var MAX_RADIUS_PX = 300; | 3 var MAX_RADIUS_PX = 300; |
| 4 var MIN_DURATION_MS = 800; | 4 var MIN_DURATION_MS = 800; |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * @param {number} x1 | 7 * @param {number} x1 |
| 8 * @param {number} y1 | 8 * @param {number} y1 |
| 9 * @param {number} x2 | 9 * @param {number} x2 |
| 10 * @param {number} y2 | 10 * @param {number} y2 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 upAction: function(e) { | 149 upAction: function(e) { |
| 150 if (!this.holdDown) | 150 if (!this.holdDown) |
| 151 this.debounce('hide ripple', function() { this.__hideRipple(); }, 1); | 151 this.debounce('hide ripple', function() { this.__hideRipple(); }, 1); |
| 152 }, | 152 }, |
| 153 | 153 |
| 154 /** | 154 /** |
| 155 * @private | 155 * @private |
| 156 * @suppress {checkTypes} | 156 * @suppress {checkTypes} |
| 157 */ | 157 */ |
| 158 __hideRipple: function() { | 158 __hideRipple: function() { |
| 159 this.ripples.forEach(function(ripple) { | 159 Promise.all(this.ripples.map(function(ripple) { |
| 160 var removeRipple = function() { ripple.remove(); }; | 160 return new Promise(function(resolve) { |
| 161 // TODO(dbeam): should we be firing a transitionend event here? Does | 161 var removeRipple = function() { |
| 162 // anybody actually use it? It's in the original paper-ripple. | 162 ripple.remove(); |
| 163 var opacity = getComputedStyle(ripple).opacity; | 163 resolve(); |
| 164 if (!opacity.length) { | 164 }; |
| 165 removeRipple(); | 165 var opacity = getComputedStyle(ripple).opacity; |
| 166 } else { | 166 if (!opacity.length) { |
| 167 var animation = ripple.animate({ | 167 removeRipple(); |
| 168 opacity: [opacity, 0], | 168 } else { |
| 169 }, { | 169 var animation = ripple.animate({ |
| 170 duration: 150, | 170 opacity: [opacity, 0], |
| 171 fill: 'forwards', | 171 }, { |
| 172 }); | 172 duration: 150, |
| 173 animation.addEventListener('finish', removeRipple); | 173 fill: 'forwards', |
| 174 animation.addEventListener('cancel', removeRipple); | 174 }); |
| 175 } | 175 animation.addEventListener('finish', removeRipple); |
| 176 }); | 176 animation.addEventListener('cancel', removeRipple); |
| 177 } |
| 178 }); |
| 179 })).then(function() { this.fire('transitionend'); }.bind(this)); |
| 177 this.ripples = []; | 180 this.ripples = []; |
| 178 }, | 181 }, |
| 179 | 182 |
| 180 /** @protected */ | 183 /** @protected */ |
| 181 _onEnterKeydown: function() { | 184 _onEnterKeydown: function() { |
| 182 this.uiDownAction(); | 185 this.uiDownAction(); |
| 183 this.async(this.uiUpAction, 1); | 186 this.async(this.uiUpAction, 1); |
| 184 }, | 187 }, |
| 185 | 188 |
| 186 /** @protected */ | 189 /** @protected */ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 198 if (oldHoldDown === undefined) | 201 if (oldHoldDown === undefined) |
| 199 return; | 202 return; |
| 200 if (newHoldDown) | 203 if (newHoldDown) |
| 201 this.downAction(); | 204 this.downAction(); |
| 202 else | 205 else |
| 203 this.upAction(); | 206 this.upAction(); |
| 204 }, | 207 }, |
| 205 }); | 208 }); |
| 206 | 209 |
| 207 })(); | 210 })(); |
| OLD | NEW |