updated jsdocs. TextPath setText() now calls Text setText(). Polygon setPoints() method now has data conversion logic similar to Line

This commit is contained in:
ericdrowell 2012-10-07 21:12:45 -07:00
parent f74955641a
commit b025767a27
10 changed files with 174 additions and 192 deletions

181
dist/kinetic-core.js vendored
View File

@ -2372,6 +2372,20 @@ Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
* @param {Object} opacity
*/
/**
* set name
* @name setName
* @methodOf Kinetic.Node.prototype
* @param {String} name
*/
/**
* set id
* @name setId
* @methodOf Kinetic.Node.prototype
* @param {String} id
*/
/**
* set draggable
* @name setDraggable
@ -2379,24 +2393,6 @@ Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
* @param {String} draggable
*/
/**
* set drag constraint.
* @name setDragConstraint
* @methodOf Kinetic.Node.prototype
* @param {String} constraint can be vertical, horizontal, or none
*/
/**
* set drag bounds.
* @name setDragBounds
* @methodOf Kinetic.Node.prototype
* @param {Object} bounds
* @config {Number} [left] left bounds position
* @config {Number} [top] top bounds position
* @config {Number} [right] right bounds position
* @config {Number} [bottom] bottom bounds position
*/
/**
* listen or don't listen to events
* @name setListening
@ -2405,11 +2401,21 @@ Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
*/
/**
* get scale
* @name getScale
* set visible
* @name setVisible
* @methodOf Kinetic.Node.prototype
* @param {Boolean} visible
*/
/**
* set drag bound function. This is used to override the default
* drag and drop position
* @name setDragBoundFunc
* @methodOf Kinetic.Node.prototype
* @param {Function} dragBoundFunc
*/
/**
* get node x position
* @name getX
@ -2446,6 +2452,12 @@ Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
* @methodOf Kinetic.Node.prototype
*/
/**
* get scale
* @name getScale
* @methodOf Kinetic.Node.prototype
*/
/**
* get offset
* @name getOffset
@ -2458,23 +2470,23 @@ Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
* @methodOf Kinetic.Node.prototype
*/
/**
* get drag constraint
* @name getDragConstraint
* @methodOf Kinetic.Node.prototype
*/
/**
* get drag bounds
* @name getDragBounds
* @methodOf Kinetic.Node.prototype
*/
/**
* determine if listening to events or not
* @name getListening
* @methodOf Kinetic.Node.prototype
*/
/**
* determine if visible or not
* @name getVisible
* @methodOf Kinetic.Node.prototype
*/
/**
* get dragBoundFunc
* @name getDragBoundFunc
* @methodOf Kinetic.Node.prototype
*/
///////////////////////////////////////////////////////////////////////
// Container
///////////////////////////////////////////////////////////////////////
@ -4317,7 +4329,7 @@ Kinetic.Shape.prototype = {
Kinetic.Global.extend(Kinetic.Shape, Kinetic.Node);
// add getters and setters
Kinetic.Node.addGettersSetters(Kinetic.Shape, ['stroke', 'lineJoin', 'strokeWidth', 'drawFunc', 'filter', 'cornerRadius']);
Kinetic.Node.addGettersSetters(Kinetic.Shape, ['stroke', 'lineJoin', 'strokeWidth', 'drawFunc', 'cornerRadius']);
Kinetic.Node.addGetters(Kinetic.Shape, ['shadow', 'fill']);
/**
@ -4350,9 +4362,10 @@ Kinetic.Node.addGetters(Kinetic.Shape, ['shadow', 'fill']);
*/
/**
* get fill
* @name getFill
* set corner radius
* @name setCornerRadius
* @methodOf Kinetic.Shape.prototype
* @param {Number} corner radius
*/
/**
@ -4374,8 +4387,8 @@ Kinetic.Node.addGetters(Kinetic.Shape, ['shadow', 'fill']);
*/
/**
* get shadow object
* @name getShadow
* get corner radius
* @name getCornerRadius
* @methodOf Kinetic.Shape.prototype
*/
@ -4384,6 +4397,18 @@ Kinetic.Node.addGetters(Kinetic.Shape, ['shadow', 'fill']);
* @name getDrawFunc
* @methodOf Kinetic.Shape.prototype
*/
/**
* get shadow object
* @name getShadow
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill
* @name getFill
* @methodOf Kinetic.Shape.prototype
*/
///////////////////////////////////////////////////////////////////////
// Rect
///////////////////////////////////////////////////////////////////////
@ -4451,13 +4476,6 @@ Kinetic.Node.addGettersSetters(Kinetic.Rect, ['width', 'height']);
* @param {Number} height
*/
/**
* set corner radius
* @name setCornerRadius
* @methodOf Kinetic.Rect.prototype
* @param {Number} radius
*/
/**
* get width
* @name getWidth
@ -4469,12 +4487,6 @@ Kinetic.Node.addGettersSetters(Kinetic.Rect, ['width', 'height']);
* @name getHeight
* @methodOf Kinetic.Rect.prototype
*/
/**
* get corner radius
* @name getCornerRadius
* @methodOf Kinetic.Rect.prototype
*/
///////////////////////////////////////////////////////////////////////
// Circle
///////////////////////////////////////////////////////////////////////
@ -4751,7 +4763,7 @@ Kinetic.Image.prototype = {
Kinetic.Global.extend(Kinetic.Image, Kinetic.Shape);
// add getters setters
Kinetic.Node.addGettersSetters(Kinetic.Image, ['image', 'filter', 'width', 'height']);
Kinetic.Node.addGettersSetters(Kinetic.Image, ['image', 'width', 'height']);
Kinetic.Node.addGetters(Kinetic.Image, ['crop']);
/**
@ -4775,13 +4787,6 @@ Kinetic.Node.addGetters(Kinetic.Image, ['crop']);
* @param {ImageObject} image
*/
/**
* set filter
* @name setFilter
* @methodOf Kinetic.Image.prototype
* @param {Object} config
*/
/**
* get crop
* @name getCrop
@ -4794,12 +4799,6 @@ Kinetic.Node.addGetters(Kinetic.Image, ['crop']);
* @methodOf Kinetic.Image.prototype
*/
/**
* get filter
* @name getFilter
* @methodOf Kinetic.Image.prototype
*/
/**
* get width
* @name getWidth
@ -4844,20 +4843,22 @@ Kinetic.Polygon.prototype = {
context.closePath();
this.fill(context);
this.stroke(context);
},
/**
* set points array
* @name setPoints
* @methodOf Kinetic.Line.prototype
* @param {Array} can be an array of point objects or an array
* of Numbers. e.g. [{x:1,y:2},{x:3,y:4}] or [1,2,3,4]
*/
setPoints: function(val) {
this.setAttr('points', Kinetic.Type._getPoints(val));
}
};
Kinetic.Global.extend(Kinetic.Polygon, Kinetic.Shape);
// add getters setters
Kinetic.Node.addGettersSetters(Kinetic.Polygon, ['points']);
/**
* set points array
* @name setPoints
* @methodOf Kinetic.Polygon.prototype
* @param {Array} points can be an array of point objects or an array
* of Numbers. e.g. [{x:1,y:2},{x:3,y:4}] or [1,2,3,4]
*/
Kinetic.Node.addGetters(Kinetic.Polygon, ['points']);
/**
* get points array
@ -5181,13 +5182,6 @@ Kinetic.Node.addGetters(Kinetic.Text, ['text']);
* @param {Number} height
*/
/**
* set shadow of text or textbox
* @name setShadow
* @methodOf Kinetic.Text.prototype
* @param {Object} config
*/
/**
* get font family
* @name getFontFamily
@ -5259,12 +5253,6 @@ Kinetic.Node.addGetters(Kinetic.Text, ['text']);
* @name getHeight
* @methodOf Kinetic.Text.prototype
*/
/**
* get shadow of text or textbox
* @name getShadow
* @methodOf Kinetic.Text.prototype
*/
///////////////////////////////////////////////////////////////////////
// Line
///////////////////////////////////////////////////////////////////////
@ -5538,7 +5526,7 @@ Kinetic.Node.addGettersSetters(Kinetic.Sprite, ['animation', 'animations', 'inde
*/
/**
* set animations obect
* set animations object
* @name setAnimations
* @methodOf Kinetic.Sprite.prototype
* @param {Object} animations
@ -6390,6 +6378,15 @@ Kinetic.TextPath.prototype = {
getTextHeight: function() {
return this.textHeight;
},
/**
* set text
* @name setText
* @methodOf Kinetic.TextPath.prototype
* @param {String} text
*/
setText: function(text) {
Kinetic.Text.prototype.setText.call(this, text);
},
_getTextSize: function(text) {
var dummyCanvas = this.dummyCanvas;
var context = dummyCanvas.getContext('2d');
@ -6579,7 +6576,8 @@ Kinetic.TextPath.prototype = {
Kinetic.Global.extend(Kinetic.TextPath, Kinetic.Shape);
// add setters and getters
Kinetic.Node.addGettersSetters(Kinetic.TextPath, ['fontFamily', 'fontSize', 'fontStyle', 'textFill', 'textStroke', 'textStrokeWidth', 'text']);
Kinetic.Node.addGettersSetters(Kinetic.TextPath, ['fontFamily', 'fontSize', 'fontStyle', 'textFill', 'textStroke', 'textStrokeWidth']);
Kinetic.Node.addGetters(Kinetic.TextPath, ['text']);
/**
* set font family
@ -6623,13 +6621,6 @@ Kinetic.Node.addGettersSetters(Kinetic.TextPath, ['fontFamily', 'fontSize', 'fon
* @param {int} textStrokeWidth
*/
/**
* set text
* @name setText
* @methodOf Kinetic.TextPath.prototype
* @param {String} text
*/
/**
* get font family
* @name getFontFamily

File diff suppressed because one or more lines are too long

View File

@ -1149,6 +1149,20 @@ Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
* @param {Object} opacity
*/
/**
* set name
* @name setName
* @methodOf Kinetic.Node.prototype
* @param {String} name
*/
/**
* set id
* @name setId
* @methodOf Kinetic.Node.prototype
* @param {String} id
*/
/**
* set draggable
* @name setDraggable
@ -1156,24 +1170,6 @@ Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
* @param {String} draggable
*/
/**
* set drag constraint.
* @name setDragConstraint
* @methodOf Kinetic.Node.prototype
* @param {String} constraint can be vertical, horizontal, or none
*/
/**
* set drag bounds.
* @name setDragBounds
* @methodOf Kinetic.Node.prototype
* @param {Object} bounds
* @config {Number} [left] left bounds position
* @config {Number} [top] top bounds position
* @config {Number} [right] right bounds position
* @config {Number} [bottom] bottom bounds position
*/
/**
* listen or don't listen to events
* @name setListening
@ -1182,11 +1178,21 @@ Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
*/
/**
* get scale
* @name getScale
* set visible
* @name setVisible
* @methodOf Kinetic.Node.prototype
* @param {Boolean} visible
*/
/**
* set drag bound function. This is used to override the default
* drag and drop position
* @name setDragBoundFunc
* @methodOf Kinetic.Node.prototype
* @param {Function} dragBoundFunc
*/
/**
* get node x position
* @name getX
@ -1223,6 +1229,12 @@ Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
* @methodOf Kinetic.Node.prototype
*/
/**
* get scale
* @name getScale
* @methodOf Kinetic.Node.prototype
*/
/**
* get offset
* @name getOffset
@ -1235,20 +1247,20 @@ Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
* @methodOf Kinetic.Node.prototype
*/
/**
* get drag constraint
* @name getDragConstraint
* @methodOf Kinetic.Node.prototype
*/
/**
* get drag bounds
* @name getDragBounds
* @methodOf Kinetic.Node.prototype
*/
/**
* determine if listening to events or not
* @name getListening
* @methodOf Kinetic.Node.prototype
*/
/**
* determine if visible or not
* @name getVisible
* @methodOf Kinetic.Node.prototype
*/
/**
* get dragBoundFunc
* @name getDragBoundFunc
* @methodOf Kinetic.Node.prototype
*/

View File

@ -529,7 +529,7 @@ Kinetic.Shape.prototype = {
Kinetic.Global.extend(Kinetic.Shape, Kinetic.Node);
// add getters and setters
Kinetic.Node.addGettersSetters(Kinetic.Shape, ['stroke', 'lineJoin', 'strokeWidth', 'drawFunc', 'filter', 'cornerRadius']);
Kinetic.Node.addGettersSetters(Kinetic.Shape, ['stroke', 'lineJoin', 'strokeWidth', 'drawFunc', 'cornerRadius']);
Kinetic.Node.addGetters(Kinetic.Shape, ['shadow', 'fill']);
/**
@ -562,9 +562,10 @@ Kinetic.Node.addGetters(Kinetic.Shape, ['shadow', 'fill']);
*/
/**
* get fill
* @name getFill
* set corner radius
* @name setCornerRadius
* @methodOf Kinetic.Shape.prototype
* @param {Number} corner radius
*/
/**
@ -586,8 +587,8 @@ Kinetic.Node.addGetters(Kinetic.Shape, ['shadow', 'fill']);
*/
/**
* get shadow object
* @name getShadow
* get corner radius
* @name getCornerRadius
* @methodOf Kinetic.Shape.prototype
*/
@ -595,4 +596,16 @@ Kinetic.Node.addGetters(Kinetic.Shape, ['shadow', 'fill']);
* get draw function
* @name getDrawFunc
* @methodOf Kinetic.Shape.prototype
*/
/**
* get shadow object
* @name getShadow
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill
* @name getFill
* @methodOf Kinetic.Shape.prototype
*/

View File

@ -156,7 +156,7 @@ Kinetic.Image.prototype = {
Kinetic.Global.extend(Kinetic.Image, Kinetic.Shape);
// add getters setters
Kinetic.Node.addGettersSetters(Kinetic.Image, ['image', 'filter', 'width', 'height']);
Kinetic.Node.addGettersSetters(Kinetic.Image, ['image', 'width', 'height']);
Kinetic.Node.addGetters(Kinetic.Image, ['crop']);
/**
@ -180,13 +180,6 @@ Kinetic.Node.addGetters(Kinetic.Image, ['crop']);
* @param {ImageObject} image
*/
/**
* set filter
* @name setFilter
* @methodOf Kinetic.Image.prototype
* @param {Object} config
*/
/**
* get crop
* @name getCrop
@ -199,12 +192,6 @@ Kinetic.Node.addGetters(Kinetic.Image, ['crop']);
* @methodOf Kinetic.Image.prototype
*/
/**
* get filter
* @name getFilter
* @methodOf Kinetic.Image.prototype
*/
/**
* get width
* @name getWidth

View File

@ -31,20 +31,22 @@ Kinetic.Polygon.prototype = {
context.closePath();
this.fill(context);
this.stroke(context);
},
/**
* set points array
* @name setPoints
* @methodOf Kinetic.Line.prototype
* @param {Array} can be an array of point objects or an array
* of Numbers. e.g. [{x:1,y:2},{x:3,y:4}] or [1,2,3,4]
*/
setPoints: function(val) {
this.setAttr('points', Kinetic.Type._getPoints(val));
}
};
Kinetic.Global.extend(Kinetic.Polygon, Kinetic.Shape);
// add getters setters
Kinetic.Node.addGettersSetters(Kinetic.Polygon, ['points']);
/**
* set points array
* @name setPoints
* @methodOf Kinetic.Polygon.prototype
* @param {Array} points can be an array of point objects or an array
* of Numbers. e.g. [{x:1,y:2},{x:3,y:4}] or [1,2,3,4]
*/
Kinetic.Node.addGetters(Kinetic.Polygon, ['points']);
/**
* get points array

View File

@ -65,13 +65,6 @@ Kinetic.Node.addGettersSetters(Kinetic.Rect, ['width', 'height']);
* @param {Number} height
*/
/**
* set corner radius
* @name setCornerRadius
* @methodOf Kinetic.Rect.prototype
* @param {Number} radius
*/
/**
* get width
* @name getWidth
@ -82,10 +75,4 @@ Kinetic.Node.addGettersSetters(Kinetic.Rect, ['width', 'height']);
* get height
* @name getHeight
* @methodOf Kinetic.Rect.prototype
*/
/**
* get corner radius
* @name getCornerRadius
* @methodOf Kinetic.Rect.prototype
*/

View File

@ -121,7 +121,7 @@ Kinetic.Node.addGettersSetters(Kinetic.Sprite, ['animation', 'animations', 'inde
*/
/**
* set animations obect
* set animations object
* @name setAnimations
* @methodOf Kinetic.Sprite.prototype
* @param {Object} animations

View File

@ -315,13 +315,6 @@ Kinetic.Node.addGetters(Kinetic.Text, ['text']);
* @param {Number} height
*/
/**
* set shadow of text or textbox
* @name setShadow
* @methodOf Kinetic.Text.prototype
* @param {Object} config
*/
/**
* get font family
* @name getFontFamily
@ -392,10 +385,4 @@ Kinetic.Node.addGetters(Kinetic.Text, ['text']);
* get height of text box
* @name getHeight
* @methodOf Kinetic.Text.prototype
*/
/**
* get shadow of text or textbox
* @name getShadow
* @methodOf Kinetic.Text.prototype
*/

View File

@ -105,6 +105,15 @@ Kinetic.TextPath.prototype = {
getTextHeight: function() {
return this.textHeight;
},
/**
* set text
* @name setText
* @methodOf Kinetic.TextPath.prototype
* @param {String} text
*/
setText: function(text) {
Kinetic.Text.prototype.setText.call(this, text);
},
_getTextSize: function(text) {
var dummyCanvas = this.dummyCanvas;
var context = dummyCanvas.getContext('2d');
@ -294,7 +303,8 @@ Kinetic.TextPath.prototype = {
Kinetic.Global.extend(Kinetic.TextPath, Kinetic.Shape);
// add setters and getters
Kinetic.Node.addGettersSetters(Kinetic.TextPath, ['fontFamily', 'fontSize', 'fontStyle', 'textFill', 'textStroke', 'textStrokeWidth', 'text']);
Kinetic.Node.addGettersSetters(Kinetic.TextPath, ['fontFamily', 'fontSize', 'fontStyle', 'textFill', 'textStroke', 'textStrokeWidth']);
Kinetic.Node.addGetters(Kinetic.TextPath, ['text']);
/**
* set font family
@ -338,13 +348,6 @@ Kinetic.Node.addGettersSetters(Kinetic.TextPath, ['fontFamily', 'fontSize', 'fon
* @param {int} textStrokeWidth
*/
/**
* set text
* @name setText
* @methodOf Kinetic.TextPath.prototype
* @param {String} text
*/
/**
* get font family
* @name getFontFamily