Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
icon size change updates icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed May 30, 2014
1 parent edecced commit 2f2a3fa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions core-icon.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@
*/
icon: '',

observe: {
'size icon': 'updateIcon'
},

defaultIconset: 'icons',

ready: function() {
if (!meta) {
meta = document.createElement('core-iconset');
}
this.sizeChanged();
},

sizeChanged: function() {
this.style.width = this.style.height = this.size + 'px';
this.updateIcon();
},

srcChanged: function() {
Expand All @@ -102,14 +102,15 @@
return meta.byId(name || this.defaultIconset);
},

iconChanged: function() {
updateIcon: function() {
this.style.width = this.style.height = this.size + 'px';
if (this.icon) {
var parts = String(this.icon).split(':');
var icon = parts.pop();
if (icon) {
var set = this.getIconset(parts.pop());
if (set) {
set.applyIcon(this, icon, this.activeTheme, this.size / set.iconSize);
set.applyIcon(this, icon, this.size / set.iconSize);
}
}
}
Expand Down

0 comments on commit 2f2a3fa

Please sign in to comment.