fixed a couple bugs introduced with transform matrix caching. Cleaned up addPointGetterSetter API. reorganized dynamic getter setter comments so that it's easier to keep track of them

This commit is contained in:
Eric Rowell
2013-05-02 10:22:21 -07:00
parent 43256d0916
commit 58b081ef12
9 changed files with 397 additions and 343 deletions

View File

@@ -862,6 +862,7 @@
}
},
_clearTransform: function() {
var trans = {
x: this.getX(),
y: this.getY(),
@@ -879,8 +880,8 @@
this.attrs.rotation = 0;
this.attrs.scaleX = 1;
this.attrs.scaleY = 1;
this.attrs.offsetX = 1;
this.attrs.offsetY = 1;
this.attrs.offsetX = 0;
this.attrs.offsetY = 0;
this.attrs.skewX = 0;
this.attrs.skewY = 0;
@@ -892,6 +893,8 @@
for(key in trans) {
this.attrs[key] = trans[key];
}
this.cachedTransform = null;
},
_fireBeforeChangeEvent: function(attr, oldVal, newVal) {
this._handleEvent(BEFORE + Kinetic.Type._capitalize(attr) + CHANGE, {
@@ -1023,8 +1026,8 @@
this.addPointSetter(constructor, attr);
// add invdividual component getters and setters
this.addGetter(constructor, attr + UPPER_X, def.x);
this.addGetter(constructor, attr + UPPER_Y, def.y);
this.addGetter(constructor, attr + UPPER_X, def);
this.addGetter(constructor, attr + UPPER_Y, def);
this.addSetter(constructor, attr + UPPER_X, isTransform);
this.addSetter(constructor, attr + UPPER_Y, isTransform);
};
@@ -1297,7 +1300,7 @@
* @methodOf Kinetic.Node.prototype
*/
Kinetic.Node.addPointGetterSetter(Kinetic.Node, 'scale', {x:1,y:1}, true);
Kinetic.Node.addPointGetterSetter(Kinetic.Node, 'scale', 1, true);
/**
* set scale
@@ -1313,7 +1316,7 @@
* @methodOf Kinetic.Node.prototype
*/
Kinetic.Node.addPointGetterSetter(Kinetic.Node, 'skew', {x:0,y:0}, true);
Kinetic.Node.addPointGetterSetter(Kinetic.Node, 'skew', 0, true);
/**
* set skew
@@ -1329,7 +1332,7 @@
* @methodOf Kinetic.Node.prototype
*/
Kinetic.Node.addPointGetterSetter(Kinetic.Node, 'offset', {x:0,y:0}, true);
Kinetic.Node.addPointGetterSetter(Kinetic.Node, 'offset', 0, true);
/**
* set offset. A node's offset defines the position and rotation point

View File

@@ -219,30 +219,6 @@
// add getters and setters
Kinetic.Node.addColorGetterSetter(Kinetic.Shape, 'stroke');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'lineJoin');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'lineCap');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'strokeWidth');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'drawFunc');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'drawHitFunc');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'dashArray');
Kinetic.Node.addColorGetterSetter(Kinetic.Shape, 'shadowColor');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'shadowBlur');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'shadowOpacity');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternImage');
Kinetic.Node.addColorGetterSetter(Kinetic.Shape, 'fill');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternX');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternY');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillLinearGradientColorStops');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillRadialGradientStartRadius');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillRadialGradientEndRadius');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillRadialGradientColorStops');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternRepeat');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillEnabled', true);
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'strokeEnabled', true);
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'shadowEnabled', true);
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'dashArrayEnabled', true);
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPriority', 'color');
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'strokeScaleEnabled', true);
/**
* set stroke color
@@ -251,6 +227,14 @@
* @param {String} stroke
*/
/**
* get stroke color
* @name getStroke
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'lineJoin');
/**
* set line join
* @name setLineJoin
@@ -259,6 +243,15 @@
* default is miter
*/
/**
* get line join
* @name getLineJoin
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'lineCap');
/**
* set line cap. Can be butt, round, or square
* @name setLineCap
@@ -266,6 +259,14 @@
* @param {String} lineCap
*/
/**
* get line cap
* @name getLineCap
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'strokeWidth');
/**
* set stroke width
* @name setStrokeWidth
@@ -273,6 +274,14 @@
* @param {Number} strokeWidth
*/
/**
* get stroke width
* @name getStrokeWidth
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'drawFunc');
/**
* set draw function
* @name setDrawFunc
@@ -280,6 +289,14 @@
* @param {Function} drawFunc drawing function
*/
/**
* get draw function
* @name getDrawFunc
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'drawHitFunc');
/**
* set draw hit function used for hit detection
* @name setDrawHitFunc
@@ -287,6 +304,14 @@
* @param {Function} drawHitFunc drawing function used for hit detection
*/
/**
* get draw hit function
* @name getDrawHitFunc
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'dashArray');
/**
* set dash array.
* @name setDashArray
@@ -300,6 +325,14 @@
* apart
*/
/**
* get dash array
* @name getDashArray
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addColorGetterSetter(Kinetic.Shape, 'shadowColor');
/**
* set shadow color
* @name setShadowColor
@@ -307,6 +340,14 @@
* @param {String} color
*/
/**
* get shadow color
* @name getShadowColor
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'shadowBlur');
/**
* set shadow blur
* @name setShadowBlur
@@ -314,6 +355,14 @@
* @param {Number} blur
*/
/**
* get shadow blur
* @name getShadowBlur
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'shadowOpacity');
/**
* set shadow opacity
* @name setShadowOpacity
@@ -321,6 +370,14 @@
* @param {Number} opacity must be a value between 0 and 1
*/
/**
* get shadow opacity
* @name getShadowOpacity
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternImage');
/**
* set fill pattern image
* @name setFillPatternImage
@@ -328,6 +385,14 @@
* @param {Image} image object
*/
/**
* get fill pattern image
* @name getFillPatternImage
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addColorGetterSetter(Kinetic.Shape, 'fill');
/**
* set fill color
* @name setFill
@@ -335,6 +400,14 @@
* @param {String} color
*/
/**
* get fill color
* @name getFill
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternX');
/**
* set fill pattern x
* @name setFillPatternX
@@ -342,6 +415,14 @@
* @param {Number} x
*/
/**
* get fill pattern x
* @name getFillPatternX
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternY');
/**
* set fill pattern y
* @name setFillPatternY
@@ -349,6 +430,14 @@
* @param {Number} y
*/
/**
* get fill pattern y
* @name getFillPatternY
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillLinearGradientColorStops');
/**
* set fill linear gradient color stops
* @name setFillLinearGradientColorStops
@@ -356,6 +445,15 @@
* @param {Array} colorStops
*/
/**
* get fill linear gradient color stops
* @name getFillLinearGradientColorStops
* @methodOf Kinetic.Shape.prototype
* @param {Array} colorStops
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillRadialGradientStartRadius');
/**
* set fill radial gradient start radius
* @name setFillRadialGradientStartRadius
@@ -363,6 +461,14 @@
* @param {Number} radius
*/
/**
* get fill radial gradient start radius
* @name getFillRadialGradientStartRadius
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillRadialGradientEndRadius');
/**
* set fill radial gradient end radius
* @name setFillRadialGradientEndRadius
@@ -370,6 +476,14 @@
* @param {Number} radius
*/
/**
* get fill radial gradient end radius
* @name getFillRadialGradientEndRadius
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillRadialGradientColorStops');
/**
* set fill radial gradient color stops
* @name setFillRadialGradientColorStops
@@ -377,6 +491,14 @@
* @param {Number} colorStops
*/
/**
* get fill radial gradient color stops
* @name getFillRadialGradientColorStops
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPatternRepeat');
/**
* set fill pattern repeat
* @name setFillPatternRepeat
@@ -384,6 +506,20 @@
* @param {Number} repeat can be 'repeat', 'repeat-x', 'repeat-y', or 'no-repeat'. The default is 'no-repeat'
*/
/**
* get fill pattern repeat
* @name getFillPatternRepeat
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillEnabled', true);
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'strokeEnabled', true);
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'shadowEnabled', true);
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'dashArrayEnabled', true);
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'fillPriority', 'color');
/**
* set fill priority
* @name setFillPriority
@@ -392,134 +528,16 @@
* The default is color.
*/
/**
* get stroke color
* @name getStroke
* @methodOf Kinetic.Shape.prototype
*/
/**
* get line join
* @name getLineJoin
* @methodOf Kinetic.Shape.prototype
*/
/**
* get line cap
* @name getLineCap
* @methodOf Kinetic.Shape.prototype
*/
/**
* get stroke width
* @name getStrokeWidth
* @methodOf Kinetic.Shape.prototype
*/
/**
* get draw function
* @name getDrawFunc
* @methodOf Kinetic.Shape.prototype
*/
/**
* get draw hit function
* @name getDrawHitFunc
* @methodOf Kinetic.Shape.prototype
*/
/**
* get dash array
* @name getDashArray
* @methodOf Kinetic.Shape.prototype
*/
/**
* get shadow color
* @name getShadowColor
* @methodOf Kinetic.Shape.prototype
*/
/**
* get shadow blur
* @name getShadowBlur
* @methodOf Kinetic.Shape.prototype
*/
/**
* get shadow opacity
* @name getShadowOpacity
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill pattern image
* @name getFillPatternImage
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill color
* @name getFill
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill pattern x
* @name getFillPatternX
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill pattern y
* @name getFillPatternY
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill linear gradient color stops
* @name getFillLinearGradientColorStops
* @methodOf Kinetic.Shape.prototype
* @param {Array} colorStops
*/
/**
* get fill radial gradient start radius
* @name getFillRadialGradientStartRadius
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill radial gradient end radius
* @name getFillRadialGradientEndRadius
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill radial gradient color stops
* @name getFillRadialGradientColorStops
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill pattern repeat
* @name getFillPatternRepeat
* @methodOf Kinetic.Shape.prototype
*/
/**
/**
* get fill priority
* @name getFillPriority
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillPatternOffset', {x:0,y:0});
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillPatternScale', {x:1,y:1});
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillLinearGradientStartPoint', {x:0,y:0});
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillLinearGradientEndPoint', {x:0,y:0});
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillRadialGradientStartPoint', {x:0,y:0});
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillRadialGradientEndPoint', {x:0,y:0});
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'shadowOffset', {x:0,y:0});
Kinetic.Node.addGetterSetter(Kinetic.Shape, 'strokeScaleEnabled', true);
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillPatternOffset', 0);
/**
* set fill pattern offset
@@ -528,6 +546,15 @@
* @param {Number|Array|Object} offset
*/
/**
* get fill pattern offset
* @name getFillPatternOffset
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillPatternScale', 1);
/**
* set fill pattern scale
* @name setFillPatternScale
@@ -535,6 +562,14 @@
* @param {Number|Array|Object} scale
*/
/**
* get fill pattern scale
* @name getFillPatternScale
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillLinearGradientStartPoint', 0);
/**
* set fill linear gradient start point
* @name setFillLinearGradientStartPoint
@@ -542,6 +577,14 @@
* @param {Number|Array|Object} startPoint
*/
/**
* get fill linear gradient start point
* @name getFillLinearGradientStartPoint
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillLinearGradientEndPoint', 0);
/**
* set fill linear gradient end point
* @name setFillLinearGradientEndPoint
@@ -549,6 +592,14 @@
* @param {Number|Array|Object} endPoint
*/
/**
* get fill linear gradient end point
* @name getFillLinearGradientEndPoint
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillRadialGradientStartPoint', 0);
/**
* set fill radial gradient start point
* @name setFillRadialGradientStartPoint
@@ -556,6 +607,14 @@
* @param {Number|Array|Object} startPoint
*/
/**
* get fill radial gradient start point
* @name getFillRadialGradientStartPoint
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'fillRadialGradientEndPoint', 0);
/**
* set fill radial gradient end point
* @name setFillRadialGradientEndPoint
@@ -563,6 +622,14 @@
* @param {Number|Array|Object} endPoint
*/
/**
* get fill radial gradient end point
* @name getFillRadialGradientEndPoint
* @methodOf Kinetic.Shape.prototype
*/
Kinetic.Node.addPointGetterSetter(Kinetic.Shape, 'shadowOffset', 0);
/**
* set shadow offset
* @name setShadowOffset
@@ -570,42 +637,6 @@
* @param {Number|Array|Object} offset
*/
/**
* get fill pattern offset
* @name getFillPatternOffset
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill pattern scale
* @name getFillPatternScale
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill linear gradient start point
* @name getFillLinearGradientStartPoint
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill linear gradient end point
* @name getFillLinearGradientEndPoint
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill radial gradient start point
* @name getFillRadialGradientStartPoint
* @methodOf Kinetic.Shape.prototype
*/
/**
* get fill radial gradient end point
* @name getFillRadialGradientEndPoint
* @methodOf Kinetic.Shape.prototype
*/
/**
* get shadow offset
* @name getShadowOffset

View File

@@ -192,10 +192,6 @@
Kinetic.Global.extend(Kinetic.LabelRect, Kinetic.Shape);
Kinetic.Node.addGetterSetter(Kinetic.LabelRect, 'pointerDirection', NONE);
Kinetic.Node.addGetterSetter(Kinetic.LabelRect, 'pointerWidth', 0);
Kinetic.Node.addGetterSetter(Kinetic.LabelRect, 'pointerHeight', 0);
Kinetic.Node.addGetterSetter(Kinetic.LabelRect, 'cornerRadius', 0);
/**
* set pointer Direction
@@ -206,6 +202,14 @@
*/
/**
* get pointer Direction
* @name getPointerDirection
* @methodOf Kinetic.LabelRect.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.LabelRect, 'pointerWidth', 0);
/**
* set pointer width
* @name setPointerWidth
* @methodOf Kinetic.LabelRect.prototype
@@ -213,12 +217,28 @@
*/
/**
* get pointer width
* @name getPointerWidth
* @methodOf Kinetic.LabelRect.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.LabelRect, 'pointerHeight', 0);
/**
* set pointer height
* @name setPointerHeight
* @methodOf Kinetic.LabelRect.prototype
* @param {Number} pointerHeight
*/
/**
* get pointer height
* @name getPointerHeight
* @methodOf Kinetic.LabelRect.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.LabelRect, 'cornerRadius', 0);
/**
* set corner radius
* @name setCornerRadius
@@ -226,24 +246,6 @@
* @param {Number} corner radius
*/
/**
* get pointer Direction
* @name getPointerDirection
* @methodOf Kinetic.LabelRect.prototype
*/
/**
* get pointer width
* @name getPointerWidth
* @methodOf Kinetic.LabelRect.prototype
*/
/**
* get pointer height
* @name getPointerHeight
* @methodOf Kinetic.LabelRect.prototype
*/
/**
* get corner radius
* @name getCornerRadius

View File

@@ -40,7 +40,6 @@
// add getters setters
Kinetic.Node.addGetterSetter(Kinetic.RegularPolygon, 'radius', 0);
Kinetic.Node.addGetterSetter(Kinetic.RegularPolygon, 'sides', 0);
/**
* set radius
@@ -49,18 +48,20 @@
* @param {Number} radius
*/
/**
* get radius
* @name getRadius
* @methodOf Kinetic.RegularPolygon.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.RegularPolygon, 'sides', 0);
/**
* set number of sides
* @name setSides
* @methodOf Kinetic.RegularPolygon.prototype
* @param {int} sides
*/
/**
* get radius
* @name getRadius
* @methodOf Kinetic.RegularPolygon.prototype
*/
/**
* get number of sides

View File

@@ -44,8 +44,6 @@
// add getters setters
Kinetic.Node.addGetterSetter(Kinetic.Star, 'numPoints', 0);
Kinetic.Node.addGetterSetter(Kinetic.Star, 'innerRadius', 0);
Kinetic.Node.addGetterSetter(Kinetic.Star, 'outerRadius', 0);
/**
* set number of points
@@ -54,13 +52,14 @@
* @param {Integer} points
*/
/**
* set outer radius
* @name setOuterRadius
/**
* get number of points
* @name getNumPoints
* @methodOf Kinetic.Star.prototype
* @param {Number} radius
*/
Kinetic.Node.addGetterSetter(Kinetic.Star, 'innerRadius', 0);
/**
* set inner radius
* @name setInnerRadius
@@ -68,21 +67,24 @@
* @param {Number} radius
*/
/**
* get number of points
* @name getNumPoints
* @methodOf Kinetic.Star.prototype
*/
/**
* get outer radius
* @name getOuterRadius
* @methodOf Kinetic.Star.prototype
*/
/**
/**
* get inner radius
* @name getInnerRadius
* @methodOf Kinetic.Star.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Star, 'outerRadius', 0);
/**
* set outer radius
* @name setOuterRadius
* @methodOf Kinetic.Star.prototype
* @param {Number} radius
*/
/**
* get outer radius
* @name getOuterRadius
* @methodOf Kinetic.Star.prototype
*/
})();

View File

@@ -313,10 +313,6 @@
// add setters and getters
Kinetic.Node.addGetterSetter(Kinetic.TextPath, 'fontFamily', CALIBRI);
Kinetic.Node.addGetterSetter(Kinetic.TextPath, 'fontSize', 12);
Kinetic.Node.addGetterSetter(Kinetic.TextPath, 'fontStyle', NORMAL);
Kinetic.Node.addGetter(Kinetic.TextPath, 'text', EMPTY_STRING);
/**
* set font family
@@ -325,6 +321,14 @@
* @param {String} fontFamily
*/
/**
* get font family
* @name getFontFamily
* @methodOf Kinetic.TextPath.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.TextPath, 'fontSize', 12);
/**
* set font size
* @name setFontSize
@@ -332,6 +336,14 @@
* @param {int} fontSize
*/
/**
* get font size
* @name getFontSize
* @methodOf Kinetic.TextPath.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.TextPath, 'fontStyle', NORMAL);
/**
* set font style. Can be 'normal', 'italic', or 'bold'. 'normal' is the default.
* @name setFontStyle
@@ -339,23 +351,13 @@
* @param {String} fontStyle
*/
/**
* get font family
* @name getFontFamily
* @methodOf Kinetic.TextPath.prototype
*/
/**
* get font size
* @name getFontSize
* @methodOf Kinetic.TextPath.prototype
*/
/**
/**
* get font style
* @name getFontStyle
* @methodOf Kinetic.TextPath.prototype
*/
Kinetic.Node.addGetter(Kinetic.TextPath, 'text', EMPTY_STRING);
/**
* get text

View File

@@ -121,10 +121,6 @@
// add getters setters
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'animation');
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'animations');
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'image');
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'index', 0);
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'frameRate', 17);
/**
* set animation key
@@ -133,13 +129,29 @@
* @param {String} anim animation key
*/
/**
* get animation key
* @name getAnimation
* @methodOf Kinetic.Sprite.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'animations');
/**
* set animations object
* set animations map
* @name setAnimations
* @methodOf Kinetic.Sprite.prototype
* @param {Object} animations
*/
/**
* get animations map
* @name getAnimations
* @methodOf Kinetic.Sprite.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'image');
/**
* set image
* @name setImage
@@ -147,6 +159,14 @@
* @param {Image} image
*/
/**
* get image
* @name getImage
* @methodOf Kinetic.Sprite.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'index', 0);
/**
* set animation frame index
* @name setIndex
@@ -154,27 +174,12 @@
* @param {Integer} index frame index
*/
/**
* get animation key
* @name getAnimation
* @methodOf Kinetic.Sprite.prototype
*/
/**
* get animations object
* @name getAnimations
* @methodOf Kinetic.Sprite.prototype
*/
/**
* get image
* @name getImage
* @methodOf Kinetic.Sprite.prototype
*/
/**
/**
* get animation frame index
* @name getIndex
* @methodOf Kinetic.Sprite.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'frameRate', 17);
})();

View File

@@ -313,17 +313,6 @@
// add getters setters
Kinetic.Node.addGetterSetter(Kinetic.Text, 'fontFamily', CALIBRI);
Kinetic.Node.addGetterSetter(Kinetic.Text, 'fontSize', 12);
Kinetic.Node.addGetterSetter(Kinetic.Text, 'fontStyle', NORMAL);
Kinetic.Node.addGetterSetter(Kinetic.Text, 'padding', 0);
Kinetic.Node.addGetterSetter(Kinetic.Text, 'align', LEFT);
Kinetic.Node.addGetterSetter(Kinetic.Text, 'lineHeight', 1);
Kinetic.Node.addGetterSetter(Kinetic.Text, 'wrap', WORD);
Kinetic.Node.addGetter(Kinetic.Text, TEXT, EMPTY_STRING);
Kinetic.Node.addSetter(Kinetic.Text, 'width');
Kinetic.Node.addSetter(Kinetic.Text, 'height');
/**
* set font family
@@ -332,6 +321,14 @@
* @param {String} fontFamily
*/
/**
* get font family
* @name getFontFamily
* @methodOf Kinetic.Text.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Text, 'fontSize', 12);
/**
* set font size in pixels
* @name setFontSize
@@ -339,6 +336,14 @@
* @param {int} fontSize
*/
/**
* get font size
* @name getFontSize
* @methodOf Kinetic.Text.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Text, 'fontStyle', NORMAL);
/**
* set font style. Can be 'normal', 'italic', or 'bold'. 'normal' is the default.
* @name setFontStyle
@@ -346,6 +351,14 @@
* @param {String} fontStyle
*/
/**
* get font style
* @name getFontStyle
* @methodOf Kinetic.Text.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Text, 'padding', 0);
/**
* set padding
* @name setPadding
@@ -353,6 +366,14 @@
* @param {int} padding
*/
/**
* get padding
* @name getPadding
* @methodOf Kinetic.Text.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Text, 'align', LEFT);
/**
* set horizontal align of text
* @name setAlign
@@ -360,6 +381,14 @@
* @param {String} align align can be 'left', 'center', or 'right'
*/
/**
* get horizontal align
* @name getAlign
* @methodOf Kinetic.Text.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Text, 'lineHeight', 1);
/**
* set line height
* @name setLineHeight
@@ -367,45 +396,22 @@
* @param {Number} lineHeight default is 1
*/
/**
* get font family
* @name getFontFamily
* @methodOf Kinetic.Text.prototype
*/
/**
* get font size
* @name getFontSize
* @methodOf Kinetic.Text.prototype
*/
/**
* get font style
* @name getFontStyle
* @methodOf Kinetic.Text.prototype
*/
/**
* get padding
* @name getPadding
* @methodOf Kinetic.Text.prototype
*/
/**
* get horizontal align
* @name getAlign
* @methodOf Kinetic.Text.prototype
*/
/**
/**
* get line height
* @name getLineHeight
* @methodOf Kinetic.Text.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Text, 'wrap', WORD);
Kinetic.Node.addGetter(Kinetic.Text, TEXT, EMPTY_STRING);
/**
* get text
* @name getText
* @methodOf Kinetic.Text.prototype
*/
Kinetic.Node.addSetter(Kinetic.Text, 'width');
Kinetic.Node.addSetter(Kinetic.Text, 'height');
})();

View File

@@ -43,8 +43,6 @@
// add getters setters
Kinetic.Node.addGetterSetter(Kinetic.Wedge, 'radius', 0);
Kinetic.Node.addGetterSetter(Kinetic.Wedge, 'angle', 0);
Kinetic.Node.addGetterSetter(Kinetic.Wedge, 'clockwise', false);
/**
* set radius
@@ -53,20 +51,42 @@
* @param {Number} radius
*/
/**
* get radius
* @name getRadius
* @methodOf Kinetic.Wedge.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Wedge, 'angle', 0);
/**
* set angle
* @name setAngle
* @methodOf Kinetic.Wedge.prototype
* @param {Number} angle
*/
/**
/**
* set angle in degrees
* @name setAngleDeg
* @methodOf Kinetic.Wedge.prototype
* @param {Number} angleDeg
*/
/**
* get angle
* @name getAngle
* @methodOf Kinetic.Wedge.prototype
*/
/**
* get angle in degrees
* @name getAngleDeg
* @methodOf Kinetic.Wedge.prototype
*/
Kinetic.Node.addGetterSetter(Kinetic.Wedge, 'clockwise', false);
/**
* set clockwise draw direction. If set to true, the wedge will be drawn clockwise
* If set to false, the wedge will be drawn anti-clockwise. The default is false.
@@ -75,24 +95,6 @@
* @param {Boolean} clockwise
*/
/**
* get radius
* @name getRadius
* @methodOf Kinetic.Wedge.prototype
*/
/**
* get angle
* @name getAngle
* @methodOf Kinetic.Wedge.prototype
*/
/**
* get angle in degrees
* @name getAngleDeg
* @methodOf Kinetic.Wedge.prototype
*/
/**
* get clockwise
* @name getClockwise