| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** Same as paper-menu-button's custom easing cubic-bezier param. */ | 5 /** Same as paper-menu-button's custom easing cubic-bezier param. */ |
| 6 var SLIDE_CUBIC_BEZIER = 'cubic-bezier(0.3, 0.95, 0.5, 1)'; | 6 var SLIDE_CUBIC_BEZIER = 'cubic-bezier(0.3, 0.95, 0.5, 1)'; |
| 7 | 7 |
| 8 Polymer({ | 8 Polymer({ |
| 9 is: 'cr-shared-menu', | 9 is: 'cr-shared-menu', |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * @type {?Object} | 22 * @type {?Object} |
| 23 */ | 23 */ |
| 24 itemData: { | 24 itemData: { |
| 25 type: Object, | 25 type: Object, |
| 26 value: null, | 26 value: null, |
| 27 }, | 27 }, |
| 28 | 28 |
| 29 openAnimationConfig: { | 29 openAnimationConfig: { |
| 30 type: Object, | 30 type: Object, |
| 31 value: function() { | 31 value: function() { |
| 32 return [{ | 32 return [ |
| 33 name: 'fade-in-animation', | 33 {name: 'fade-in-animation', timing: {delay: 50, duration: 200}}, { |
| 34 timing: { | 34 name: 'paper-menu-grow-width-animation', |
| 35 delay: 50, | 35 timing: {delay: 50, duration: 150, easing: SLIDE_CUBIC_BEZIER} |
| 36 duration: 200 | 36 }, |
| 37 { |
| 38 name: 'paper-menu-grow-height-animation', |
| 39 timing: {delay: 100, duration: 275, easing: SLIDE_CUBIC_BEZIER} |
| 37 } | 40 } |
| 38 }, { | 41 ]; |
| 39 name: 'paper-menu-grow-width-animation', | |
| 40 timing: { | |
| 41 delay: 50, | |
| 42 duration: 150, | |
| 43 easing: SLIDE_CUBIC_BEZIER | |
| 44 } | |
| 45 }, { | |
| 46 name: 'paper-menu-grow-height-animation', | |
| 47 timing: { | |
| 48 delay: 100, | |
| 49 duration: 275, | |
| 50 easing: SLIDE_CUBIC_BEZIER | |
| 51 } | |
| 52 }]; | |
| 53 } | 42 } |
| 54 }, | 43 }, |
| 55 | 44 |
| 56 closeAnimationConfig: { | 45 closeAnimationConfig: { |
| 57 type: Object, | 46 type: Object, |
| 58 value: function() { | 47 value: function() { |
| 59 return [{ | 48 return [{name: 'fade-out-animation', timing: {duration: 150}}]; |
| 60 name: 'fade-out-animation', | |
| 61 timing: { | |
| 62 duration: 150 | |
| 63 } | |
| 64 }]; | |
| 65 } | 49 } |
| 66 } | 50 } |
| 67 }, | 51 }, |
| 68 | 52 |
| 69 listeners: { | 53 listeners: { |
| 70 'dropdown.iron-overlay-canceled': 'onOverlayCanceled_', | 54 'dropdown.iron-overlay-canceled': 'onOverlayCanceled_', |
| 71 }, | 55 }, |
| 72 | 56 |
| 73 /** | 57 /** |
| 74 * The last anchor that was used to open a menu. It's necessary for toggling. | 58 * The last anchor that was used to open a menu. It's necessary for toggling. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 * Prevent focus restoring when tapping outside the menu. This stops the | 154 * Prevent focus restoring when tapping outside the menu. This stops the |
| 171 * focus moving around unexpectedly when closing the menu with the mouse. | 155 * focus moving around unexpectedly when closing the menu with the mouse. |
| 172 * @param {CustomEvent} e | 156 * @param {CustomEvent} e |
| 173 * @private | 157 * @private |
| 174 */ | 158 */ |
| 175 onOverlayCanceled_: function(e) { | 159 onOverlayCanceled_: function(e) { |
| 176 if (e.detail.type == 'tap') | 160 if (e.detail.type == 'tap') |
| 177 this.$.dropdown.restoreFocusOnClose = false; | 161 this.$.dropdown.restoreFocusOnClose = false; |
| 178 }, | 162 }, |
| 179 }); | 163 }); |
| OLD | NEW |