removed john resig's Class class because it was really slowing down node instantiations. Created a custom solution that's much lighter weight, and about 50% faster

This commit is contained in:
Eric Rowell
2012-08-22 23:35:21 -07:00
parent 45cf237ce0
commit 1ad2530889
18 changed files with 2279 additions and 126 deletions

View File

@@ -8,8 +8,12 @@
* @augments Kinetic.Shape
* @param {Object} config
*/
Kinetic.TextPath = Kinetic.Shape.extend({
init: function(config) {
Kinetic.TextPath = function(config) {
this._initTextPath(config);
};
Kinetic.TextPath.prototype = {
_initTextPath: function(config) {
this.setDefaultAttrs({
fontFamily: 'Calibri',
fontSize: 12,
@@ -25,7 +29,7 @@ Kinetic.TextPath = Kinetic.Shape.extend({
config.drawFunc = this.drawFunc;
// call super constructor
this._super(config);
Kinetic.Shape.call(this, config);
this.dataArray = Kinetic.Path.parsePathData(this.attrs.data);
this.on('dataChange', function() {
that.dataArray = Kinetic.Path.parsePathData(this.attrs.data);
@@ -279,7 +283,8 @@ Kinetic.TextPath = Kinetic.Shape.extend({
p0 = p1;
}
}
});
};
Kinetic.Global.extend(Kinetic.TextPath, Kinetic.Shape);
// add setters and getters
Kinetic.Node.addGettersSetters(Kinetic.TextPath, ['fontFamily', 'fontSize', 'fontStyle', 'textFill', 'textStroke', 'textStrokeWidth', 'text']);