| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 (function() { | 5 (function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 Polymer('volume-controller', { | 8 /** |
| 9 * @constructor |
| 10 * @extends {PolymerElement} |
| 11 */ |
| 12 var VolumeControllerElement = function() {}; |
| 13 |
| 14 VolumeControllerElement.prototype = { |
| 9 /** | 15 /** |
| 10 * Initializes an element. This method is called automatically when the | 16 * Initializes an element. This method is called automatically when the |
| 11 * element is ready. | 17 * element is ready. |
| 12 */ | 18 */ |
| 13 ready: function() { | 19 ready: function() { |
| 14 this.style.width = this.width + 'px'; | 20 this.style.width = this.width + 'px'; |
| 15 this.style.height = this.height + 'px'; | 21 this.style.height = this.height + 'px'; |
| 16 | 22 |
| 17 this.$.rawValueInput.style.width = this.height + 'px'; | 23 this.rawValueInput = this.$.rawValueInput; |
| 18 this.$.rawValueInput.style.height = this.width + 'px'; | 24 this.bar = this.$.bar; |
| 19 this.$.rawValueInput.style.webkitTransformOrigin = | 25 |
| 26 this.rawValueInput.style.width = this.height + 'px'; |
| 27 this.rawValueInput.style.height = this.width + 'px'; |
| 28 this.rawValueInput.style.webkitTransformOrigin = |
| 20 (this.width / 2) + 'px ' + | 29 (this.width / 2) + 'px ' + |
| 21 (this.width / 2 - 2) + 'px'; | 30 (this.width / 2 - 2) + 'px'; |
| 22 | 31 |
| 23 var barLeft = (this.width / 2 - 1); | 32 var barLeft = (this.width / 2 - 1); |
| 24 this.$.bar.style.left = barLeft + 'px'; | 33 this.bar.style.left = barLeft + 'px'; |
| 25 this.$.bar.style.right = barLeft + 'px'; | 34 this.bar.style.right = barLeft + 'px'; |
| 26 | 35 |
| 27 this.addEventListener('keydown', this.onKeyDown_.bind(this)); | 36 this.addEventListener('keydown', this.onKeyDown_.bind(this)); |
| 28 }, | 37 }, |
| 29 | 38 |
| 30 /** | 39 /** |
| 31 * Registers handlers for changing of external variables | 40 * Registers handlers for changing of external variables |
| 32 */ | 41 */ |
| 33 observe: { | 42 observe: { |
| 34 'model.volume': 'onVolumeChanged', | 43 'model.volume': 'onVolumeChanged', |
| 35 }, | 44 }, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Prevents the default behavior. These key should be handled in | 113 // Prevents the default behavior. These key should be handled in |
| 105 // <audio-player> element. | 114 // <audio-player> element. |
| 106 case 'Up': | 115 case 'Up': |
| 107 case 'Down': | 116 case 'Down': |
| 108 case 'PageUp': | 117 case 'PageUp': |
| 109 case 'PageDown': | 118 case 'PageDown': |
| 110 event.preventDefault(); | 119 event.preventDefault(); |
| 111 break; | 120 break; |
| 112 } | 121 } |
| 113 }, | 122 }, |
| 114 }); | 123 }; |
| 124 |
| 125 Polymer('volume-controller', VolumeControllerElement.prototype); |
| 115 })(); // Anonymous closure | 126 })(); // Anonymous closure |
| OLD | NEW |