Created
January 10, 2013 22:57
-
-
Save c4urself/4506532 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
na.iconCreator = function (x, y, width, height, iconName, hoverTitle, sstr) { | |
var p = this.properties, | |
dim = this.wrapper.getBBox(), | |
wx = _.isFunction(x) ? x(dim) : x, wy = _.isFunction(y) ? y(dim) : y, | |
r = this.paper.rect(wx, wy, width, height), | |
i = this.paper.path(na.icons[iconName]); | |
set = this.paper.set(); | |
tstr = (sstr || 'S0.05,0.05,0,0') + 'T' + wx + ',' + wy; | |
// This is a hack to get all icons doing the same thing | |
na.movePath.apply(i, [1, 1]); | |
i.transform(tstr).attr(na.style.toolBoxItem) | |
r.attr({'stroke-width': 0, href: 'javasript://', title: hoverTitle}).hover(function () { | |
i.stop().animate({'stroke-width': 1, fill: na.opts.darkGrey}, 200); | |
}, function () { | |
i.stop().attr({'stroke-width': 0, fill: na.opts.mediumGrey}); | |
}).node.onclick = p.label.onclick; | |
return set.push(i, r); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment