| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> | 9 --> |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 <iron-iconset id="my-icons" src="my-icons.png" width="96" size="24" | 47 <iron-iconset id="my-icons" src="my-icons.png" width="96" size="24" |
| 48 icons="location place starta stopb bus car train walk"> | 48 icons="location place starta stopb bus car train walk"> |
| 49 <property theme="special" offsetX="256" offsetY="24"></property> | 49 <property theme="special" offsetX="256" offsetY="24"></property> |
| 50 </iron-iconset> | 50 </iron-iconset> |
| 51 | 51 |
| 52 Then a themed icon can be applied like this: | 52 Then a themed icon can be applied like this: |
| 53 | 53 |
| 54 iconset.applyIcon(iconNode, 'car', 'special'); | 54 iconset.applyIcon(iconNode, 'car', 'special'); |
| 55 | 55 |
| 56 @element iron-iconset | 56 @element iron-iconset |
| 57 @demo demo/index.html |
| 57 --> | 58 --> |
| 58 | 59 |
| 59 <script> | 60 <script> |
| 60 | 61 |
| 61 Polymer({ | 62 Polymer({ |
| 62 | 63 |
| 63 is: 'iron-iconset', | 64 is: 'iron-iconset', |
| 64 | 65 |
| 65 properties: { | 66 properties: { |
| 66 | 67 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 /** | 178 /** |
| 178 * Applies an icon to the given element as a css background image. This | 179 * Applies an icon to the given element as a css background image. This |
| 179 * method does not size the element, and it's usually necessary to set | 180 * method does not size the element, and it's usually necessary to set |
| 180 * the element's height and width so that the background image is visible. | 181 * the element's height and width so that the background image is visible. |
| 181 * | 182 * |
| 182 * @method applyIcon | 183 * @method applyIcon |
| 183 * @param {Element} element The element to which the icon is applied. | 184 * @param {Element} element The element to which the icon is applied. |
| 184 * @param {String|Number} icon The name or index of the icon to apply. | 185 * @param {String|Number} icon The name or index of the icon to apply. |
| 185 * @param {String} theme (optional) The name or index of the icon to apply. | 186 * @param {String} theme (optional) The name or index of the icon to apply. |
| 186 * @param {Number} scale (optional, defaults to 1) Icon scaling factor. | 187 * @param {Number} scale (optional, defaults to 1) Icon scaling factor. |
| 187 * @return {Element} The applied icon element. | |
| 188 */ | 188 */ |
| 189 applyIcon: function(element, icon, theme, scale) { | 189 applyIcon: function(element, icon, theme, scale) { |
| 190 this._validateIconMap(); | 190 this._validateIconMap(); |
| 191 var offset = this._getThemedOffset(icon, theme); | 191 var offset = this._getThemedOffset(icon, theme); |
| 192 if (element && offset) { | 192 if (element && offset) { |
| 193 this._addIconStyles(element, this._srcUrl, offset, scale || 1, | 193 this._addIconStyles(element, this._srcUrl, offset, scale || 1, |
| 194 this.size, this.width); | 194 this.size, this.width); |
| 195 } | 195 } |
| 196 }, | 196 }, |
| 197 | 197 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 element.setAttribute('role', 'img'); | 327 element.setAttribute('role', 'img'); |
| 328 }, | 328 }, |
| 329 | 329 |
| 330 _removeIconStyles: function(style) { | 330 _removeIconStyles: function(style) { |
| 331 style.background = ''; | 331 style.background = ''; |
| 332 } | 332 } |
| 333 | 333 |
| 334 }); | 334 }); |
| 335 | 335 |
| 336 </script> | 336 </script> |
| OLD | NEW |