Skip to content

Instantly share code, notes, and snippets.

@vird
Last active August 29, 2015 14:01
Show Gist options
  • Save vird/42a9a2097fa92002c65c to your computer and use it in GitHub Desktop.
Save vird/42a9a2097fa92002c65c to your computer and use it in GitHub Desktop.
// replace in .attr functions (there are two .attr functions)
for (var key in params) {
eve("raphael.attr." + key + "." + this.id, this, params[key]);
}
// with
var numericParams = {
r:1,rx:1,ry:1,x:1,y:1,cx:1,cy:1,width:1,height:1
};
for (var key in params) {
if (numericParams[key]) {
params[key] = +params[key];
}
eve("raphael.attr." + key + "." + this.id, this, params[key]);
}
// It's better make numericParams static somewhere
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment