moved TextPath, RegularPolygon, and Star shapes to the plugins directory. updated all tests

This commit is contained in:
Eric Rowell
2013-03-13 22:24:55 -07:00
parent 012e495a69
commit 5c590bb88f
14 changed files with 72 additions and 64 deletions

View File

@@ -9,11 +9,11 @@
* {{ShapeParams}}
* {{NodeParams}}
*/
Kinetic.RegularPolygon = function(config) {
Kinetic.Plugins.RegularPolygon = function(config) {
this._initRegularPolygon(config);
};
Kinetic.RegularPolygon.prototype = {
Kinetic.Plugins.RegularPolygon.prototype = {
_initRegularPolygon: function(config) {
this.setDefaultAttrs({
radius: 0,
@@ -39,34 +39,34 @@
canvas.fillStroke(this);
}
};
Kinetic.Global.extend(Kinetic.RegularPolygon, Kinetic.Shape);
Kinetic.Global.extend(Kinetic.Plugins.RegularPolygon, Kinetic.Shape);
// add getters setters
Kinetic.Node.addGettersSetters(Kinetic.RegularPolygon, ['radius', 'sides']);
Kinetic.Node.addGettersSetters(Kinetic.Plugins.RegularPolygon, ['radius', 'sides']);
/**
* set radius
* @name setRadius
* @methodOf Kinetic.RegularPolygon.prototype
* @methodOf Kinetic.Plugins.RegularPolygon.prototype
* @param {Number} radius
*/
/**
* set number of sides
* @name setSides
* @methodOf Kinetic.RegularPolygon.prototype
* @methodOf Kinetic.Plugins.RegularPolygon.prototype
* @param {int} sides
*/
/**
* get radius
* @name getRadius
* @methodOf Kinetic.RegularPolygon.prototype
* @methodOf Kinetic.Plugins.RegularPolygon.prototype
*/
/**
* get number of sides
* @name getSides
* @methodOf Kinetic.RegularPolygon.prototype
* @methodOf Kinetic.Plugins.RegularPolygon.prototype
*/
})();

View File

@@ -10,11 +10,11 @@
* {{ShapeParams}}
* {{NodeParams}}
*/
Kinetic.Star = function(config) {
Kinetic.Plugins.Star = function(config) {
this._initStar(config);
};
Kinetic.Star.prototype = {
Kinetic.Plugins.Star.prototype = {
_initStar: function(config) {
this.setDefaultAttrs({
numPoints: 0,
@@ -44,47 +44,47 @@
canvas.fillStroke(this);
}
};
Kinetic.Global.extend(Kinetic.Star, Kinetic.Shape);
Kinetic.Global.extend(Kinetic.Plugins.Star, Kinetic.Shape);
// add getters setters
Kinetic.Node.addGettersSetters(Kinetic.Star, ['numPoints', 'innerRadius', 'outerRadius']);
Kinetic.Node.addGettersSetters(Kinetic.Plugins.Star, ['numPoints', 'innerRadius', 'outerRadius']);
/**
* set number of points
* @name setNumPoints
* @methodOf Kinetic.Star.prototype
* @methodOf Kinetic.Plugins.Star.prototype
* @param {Integer} points
*/
/**
* set outer radius
* @name setOuterRadius
* @methodOf Kinetic.Star.prototype
* @methodOf Kinetic.Plugins.Star.prototype
* @param {Number} radius
*/
/**
* set inner radius
* @name setInnerRadius
* @methodOf Kinetic.Star.prototype
* @methodOf Kinetic.Plugins.Star.prototype
* @param {Number} radius
*/
/**
* get number of points
* @name getNumPoints
* @methodOf Kinetic.Star.prototype
* @methodOf Kinetic.Plugins.Star.prototype
*/
/**
* get outer radius
* @name getOuterRadius
* @methodOf Kinetic.Star.prototype
* @methodOf Kinetic.Plugins.Star.prototype
*/
/**
* get inner radius
* @name getInnerRadius
* @methodOf Kinetic.Star.prototype
* @methodOf Kinetic.Plugins.Star.prototype
*/
})();

View File

@@ -12,7 +12,7 @@
* {{ShapeParams}}
* {{NodeParams}}
*/
Kinetic.TextPath = function(config) {
Kinetic.Plugins.TextPath = function(config) {
this._initTextPath(config);
};
@@ -23,7 +23,7 @@
context.strokeText(this.partialText, 0, 0);
}
Kinetic.TextPath.prototype = {
Kinetic.Plugins.TextPath.prototype = {
_initTextPath: function(config) {
this.setDefaultAttrs({
fontFamily: 'Calibri',
@@ -96,7 +96,7 @@
/**
* get text width in pixels
* @name getTextWidth
* @methodOf Kinetic.TextPath.prototype
* @methodOf Kinetic.Plugins.TextPath.prototype
*/
getTextWidth: function() {
return this.textWidth;
@@ -104,7 +104,7 @@
/**
* get text height in pixels
* @name getTextHeight
* @methodOf Kinetic.TextPath.prototype
* @methodOf Kinetic.Plugins.TextPath.prototype
*/
getTextHeight: function() {
return this.textHeight;
@@ -112,7 +112,7 @@
/**
* set text
* @name setText
* @methodOf Kinetic.TextPath.prototype
* @methodOf Kinetic.Plugins.TextPath.prototype
* @param {String} text
*/
setText: function(text) {
@@ -304,54 +304,54 @@
}
}
};
Kinetic.Global.extend(Kinetic.TextPath, Kinetic.Shape);
Kinetic.Global.extend(Kinetic.Plugins.TextPath, Kinetic.Shape);
// add setters and getters
Kinetic.Node.addGettersSetters(Kinetic.TextPath, ['fontFamily', 'fontSize', 'fontStyle']);
Kinetic.Node.addGetters(Kinetic.TextPath, ['text']);
Kinetic.Node.addGettersSetters(Kinetic.Plugins.TextPath, ['fontFamily', 'fontSize', 'fontStyle']);
Kinetic.Node.addGetters(Kinetic.Plugins.TextPath, ['text']);
/**
* set font family
* @name setFontFamily
* @methodOf Kinetic.TextPath.prototype
* @methodOf Kinetic.Plugins.TextPath.prototype
* @param {String} fontFamily
*/
/**
* set font size
* @name setFontSize
* @methodOf Kinetic.TextPath.prototype
* @methodOf Kinetic.Plugins.TextPath.prototype
* @param {int} fontSize
*/
/**
* set font style. Can be 'normal', 'italic', or 'bold'. 'normal' is the default.
* @name setFontStyle
* @methodOf Kinetic.TextPath.prototype
* @methodOf Kinetic.Plugins.TextPath.prototype
* @param {String} fontStyle
*/
/**
* get font family
* @name getFontFamily
* @methodOf Kinetic.TextPath.prototype
* @methodOf Kinetic.Plugins.TextPath.prototype
*/
/**
* get font size
* @name getFontSize
* @methodOf Kinetic.TextPath.prototype
* @methodOf Kinetic.Plugins.TextPath.prototype
*/
/**
* get font style
* @name getFontStyle
* @methodOf Kinetic.TextPath.prototype
* @methodOf Kinetic.Plugins.TextPath.prototype
*/
/**
* get text
* @name getText
* @methodOf Kinetic.TextPath.prototype
* @methodOf Kinetic.Plugins.TextPath.prototype
*/
})();