mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
moved TextPath, RegularPolygon, and Star shapes to the plugins directory. updated all tests
This commit is contained in:
@@ -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
|
||||
*/
|
||||
})();
|
@@ -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
|
||||
*/
|
||||
})();
|
@@ -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
|
||||
*/
|
||||
})();
|
Reference in New Issue
Block a user