OLD | NEW |
1 | 1 |
2 | 2 |
3 Polymer({ | 3 Polymer({ |
4 | 4 |
5 is: 'paper-button', | 5 is: 'paper-button', |
6 | 6 |
7 behaviors: [ | 7 behaviors: [ |
8 Polymer.PaperButtonBehavior | 8 Polymer.PaperButtonBehavior |
9 ], | 9 ], |
10 | 10 |
11 properties: { | 11 properties: { |
12 | 12 |
13 /** | 13 /** |
14 * If true, the button should be styled with a shadow. | 14 * If true, the button should be styled with a shadow. |
15 * | |
16 * @attribute raised | |
17 * @type boolean | |
18 * @default false | |
19 */ | 15 */ |
20 raised: { | 16 raised: { |
21 type: Boolean, | 17 type: Boolean, |
22 reflectToAttribute: true, | 18 reflectToAttribute: true, |
23 value: false, | 19 value: false, |
24 observer: '_buttonStateChanged' | 20 observer: '_calculateElevation' |
25 } | |
26 | |
27 }, | |
28 | |
29 ready: function() { | |
30 if (!this.hasAttribute('role')) { | |
31 this.setAttribute('role', 'button'); | |
32 } | 21 } |
33 }, | 22 }, |
34 | 23 |
35 _buttonStateChanged: function() { | 24 _calculateElevation: function() { |
36 this._calculateElevation(); | 25 if (!this.raised) { |
| 26 this._elevation = 0; |
| 27 } else { |
| 28 Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this); |
| 29 } |
| 30 }, |
| 31 |
| 32 _computeContentClass: function(receivedFocusFromKeyboard) { |
| 33 var className = 'content '; |
| 34 if (receivedFocusFromKeyboard) { |
| 35 className += ' keyboard-focus'; |
| 36 } |
| 37 return className; |
37 } | 38 } |
38 | |
39 }); | 39 }); |
40 | 40 |
OLD | NEW |