mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
finished the major doc updates
This commit is contained in:
@@ -191,14 +191,16 @@
|
||||
* set drag bound function. This is used to override the default
|
||||
* drag and drop position
|
||||
* @name setDragBoundFunc
|
||||
* @methodOf Kinetic.Node.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Node.prototype
|
||||
* @param {Function} dragBoundFunc
|
||||
*/
|
||||
|
||||
/**
|
||||
* get dragBoundFunc
|
||||
* @name getDragBoundFunc
|
||||
* @methodOf Kinetic.Node.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Node.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetter(Kinetic.Node, 'draggable', false);
|
||||
@@ -206,21 +208,25 @@
|
||||
/**
|
||||
* get draggable
|
||||
* @name getDraggable
|
||||
* @methodOf Kinetic.Node.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Node.prototype
|
||||
*/
|
||||
|
||||
/**
|
||||
* get draggable. Alias of getDraggable()
|
||||
* alias of getDraggable()
|
||||
* @name isDraggable
|
||||
* @methodOf Kinetic.Node.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Node.prototype
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* alias of getDraggable
|
||||
* @name isDraggable
|
||||
* @methodOf Kinetic.Node.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Node.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
|
||||
|
||||
var html = document.getElementsByTagName('html')[0];
|
||||
|
@@ -53,7 +53,7 @@
|
||||
* @example
|
||||
* node.on('click', function() {<br>
|
||||
* console.log('you clicked me!');<br>
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
on: function(typesStr, handler) {
|
||||
var types = typesStr.split(SPACE),
|
||||
|
@@ -23,12 +23,14 @@
|
||||
* get filter brightness. The brightness is a number between -255 and 255. Positive values
|
||||
* increase the brightness and negative values decrease the brightness, making the image darker
|
||||
* @name getFilterBrightness
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
*/
|
||||
|
||||
/**
|
||||
* set filter brightness
|
||||
* @name setFilterBrightness
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
*/
|
||||
})();
|
||||
|
@@ -14,6 +14,7 @@
|
||||
/**
|
||||
* Label constructor. Labels are groups that contain Text and LabelRect shape
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @param {Object} config
|
||||
* @param {Object} config.text Text config
|
||||
* @param {String} [config.text.fontFamily] default is Calibri
|
||||
@@ -102,28 +103,35 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* get LabelRect shape for the label. You need to access the LabelRect shape in order to update
|
||||
* the pointer properties and the corner radius
|
||||
* @name getRect
|
||||
* @methodOf Kinetic.Label.prototype
|
||||
*/
|
||||
Kinetic.Util.extend(Kinetic.Label, Kinetic.Group);
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Label, 'text');
|
||||
|
||||
/**
|
||||
* get Text shape for the label. You need to access the Text shape in order to update
|
||||
* the text properties
|
||||
* @name getText
|
||||
* @methodOf Kinetic.Label.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Label.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Util.extend(Kinetic.Label, Kinetic.Group);
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Label, 'text');
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Label, 'rect');
|
||||
|
||||
/**
|
||||
* get LabelRect shape for the label. You need to access the LabelRect shape in order to update
|
||||
* the pointer properties and the corner radius
|
||||
* @name getRect
|
||||
* @method
|
||||
* @memberof Kinetic.Label.prototype
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* LabelRect constructor. A LabelRect is similar to a Rect, except that it can be configured
|
||||
* to have a pointer element that points up, right, down, or left
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @abstract
|
||||
* @param {Object} config
|
||||
* @param {String} [config.pointerDirection] can be up, right, down, left, or none; the default
|
||||
* is none. When a pointer is present, the positioning of the label is relative to the tip of the pointer.
|
||||
@@ -196,7 +204,8 @@
|
||||
/**
|
||||
* set pointer Direction
|
||||
* @name setPointerDirection
|
||||
* @methodOf Kinetic.LabelRect.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.LabelRect.prototype
|
||||
* @param {String} pointerDirection can be up, right, down, left, or none. The
|
||||
* default is none
|
||||
*/
|
||||
@@ -204,7 +213,8 @@
|
||||
/**
|
||||
* get pointer Direction
|
||||
* @name getPointerDirection
|
||||
* @methodOf Kinetic.LabelRect.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.LabelRect.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.LabelRect, 'pointerWidth', 0);
|
||||
@@ -212,14 +222,16 @@
|
||||
/**
|
||||
* set pointer width
|
||||
* @name setPointerWidth
|
||||
* @methodOf Kinetic.LabelRect.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.LabelRect.prototype
|
||||
* @param {Number} pointerWidth
|
||||
*/
|
||||
|
||||
/**
|
||||
* get pointer width
|
||||
* @name getPointerWidth
|
||||
* @methodOf Kinetic.LabelRect.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.LabelRect.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.LabelRect, 'pointerHeight', 0);
|
||||
@@ -227,14 +239,16 @@
|
||||
/**
|
||||
* set pointer height
|
||||
* @name setPointerHeight
|
||||
* @methodOf Kinetic.LabelRect.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.LabelRect.prototype
|
||||
* @param {Number} pointerHeight
|
||||
*/
|
||||
|
||||
/**
|
||||
* get pointer height
|
||||
* @name getPointerHeight
|
||||
* @methodOf Kinetic.LabelRect.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.LabelRect.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.LabelRect, 'cornerRadius', 0);
|
||||
@@ -242,13 +256,15 @@
|
||||
/**
|
||||
* set corner radius
|
||||
* @name setCornerRadius
|
||||
* @methodOf Kinetic.LabelRect.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.LabelRect.prototype
|
||||
* @param {Number} corner radius
|
||||
*/
|
||||
|
||||
/**
|
||||
* get corner radius
|
||||
* @name getCornerRadius
|
||||
* @methodOf Kinetic.LabelRect.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.LabelRect.prototype
|
||||
*/
|
||||
})();
|
@@ -3,6 +3,7 @@
|
||||
* Path constructor.
|
||||
* @author Jason Follas
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {String} config.data SVG data string
|
||||
@@ -175,7 +176,7 @@
|
||||
y: cy + (pt.x * sinPsi + pt.y * cosPsi)
|
||||
};
|
||||
};
|
||||
/**
|
||||
/*
|
||||
* get parsed data array from the data
|
||||
* string. V, v, H, h, and l data are converted to
|
||||
* L data for the purpose of high performance Path
|
||||
@@ -547,13 +548,15 @@
|
||||
* into a data array. Currently supported SVG data:
|
||||
* M, m, L, l, H, h, V, v, Q, q, T, t, C, c, S, s, A, a, Z, z
|
||||
* @name setData
|
||||
* @methodOf Kinetic.Path.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Path.prototype
|
||||
* @param {String} SVG path command string
|
||||
*/
|
||||
|
||||
/**
|
||||
* get SVG path data string
|
||||
* @name getData
|
||||
* @methodOf Kinetic.Path.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Path.prototype
|
||||
*/
|
||||
})();
|
||||
|
@@ -2,6 +2,7 @@
|
||||
/**
|
||||
* RegularPolygon constructor. Examples include triangles, squares, pentagons, hexagons, etc.
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {Number} config.sides
|
||||
@@ -44,14 +45,16 @@
|
||||
/**
|
||||
* set radius
|
||||
* @name setRadius
|
||||
* @methodOf Kinetic.RegularPolygon.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.RegularPolygon.prototype
|
||||
* @param {Number} radius
|
||||
*/
|
||||
|
||||
/**
|
||||
* get radius
|
||||
* @name getRadius
|
||||
* @methodOf Kinetic.RegularPolygon.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.RegularPolygon.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.RegularPolygon, 'sides', 0);
|
||||
@@ -59,13 +62,15 @@
|
||||
/**
|
||||
* set number of sides
|
||||
* @name setSides
|
||||
* @methodOf Kinetic.RegularPolygon.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.RegularPolygon.prototype
|
||||
* @param {int} sides
|
||||
*/
|
||||
|
||||
/**
|
||||
* get number of sides
|
||||
* @name getSides
|
||||
* @methodOf Kinetic.RegularPolygon.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.RegularPolygon.prototype
|
||||
*/
|
||||
})();
|
||||
|
@@ -2,6 +2,7 @@
|
||||
/**
|
||||
* Star constructor
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {Integer} config.numPoints
|
||||
@@ -48,14 +49,16 @@
|
||||
/**
|
||||
* set number of points
|
||||
* @name setNumPoints
|
||||
* @methodOf Kinetic.Star.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Star.prototype
|
||||
* @param {Integer} points
|
||||
*/
|
||||
|
||||
/**
|
||||
* get number of points
|
||||
* @name getNumPoints
|
||||
* @methodOf Kinetic.Star.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Star.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Star, 'innerRadius', 0);
|
||||
@@ -63,14 +66,16 @@
|
||||
/**
|
||||
* set inner radius
|
||||
* @name setInnerRadius
|
||||
* @methodOf Kinetic.Star.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Star.prototype
|
||||
* @param {Number} radius
|
||||
*/
|
||||
|
||||
/**
|
||||
* get inner radius
|
||||
* @name getInnerRadius
|
||||
* @methodOf Kinetic.Star.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Star.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Star, 'outerRadius', 0);
|
||||
@@ -78,13 +83,15 @@
|
||||
/**
|
||||
* set outer radius
|
||||
* @name setOuterRadius
|
||||
* @methodOf Kinetic.Star.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Star.prototype
|
||||
* @param {Number} radius
|
||||
*/
|
||||
|
||||
/**
|
||||
* get outer radius
|
||||
* @name getOuterRadius
|
||||
* @methodOf Kinetic.Star.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Star.prototype
|
||||
*/
|
||||
})();
|
||||
|
@@ -7,6 +7,7 @@
|
||||
* Path constructor.
|
||||
* @author Jason Follas
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {String} [config.fontFamily] default is Calibri
|
||||
@@ -96,24 +97,24 @@
|
||||
},
|
||||
/**
|
||||
* get text width in pixels
|
||||
* @name getTextWidth
|
||||
* @methodOf Kinetic.TextPath.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.TextPath.prototype
|
||||
*/
|
||||
getTextWidth: function() {
|
||||
return this.textWidth;
|
||||
},
|
||||
/**
|
||||
* get text height in pixels
|
||||
* @name getTextHeight
|
||||
* @methodOf Kinetic.TextPath.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.TextPath.prototype
|
||||
*/
|
||||
getTextHeight: function() {
|
||||
return this.textHeight;
|
||||
},
|
||||
/**
|
||||
* set text
|
||||
* @name setText
|
||||
* @methodOf Kinetic.TextPath.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.TextPath.prototype
|
||||
* @param {String} text
|
||||
*/
|
||||
setText: function(text) {
|
||||
@@ -135,9 +136,6 @@
|
||||
height: parseInt(this.attrs.fontSize, 10)
|
||||
};
|
||||
},
|
||||
/**
|
||||
* set text data.
|
||||
*/
|
||||
_setTextData: function() {
|
||||
|
||||
var that = this;
|
||||
@@ -317,14 +315,16 @@
|
||||
/**
|
||||
* set font family
|
||||
* @name setFontFamily
|
||||
* @methodOf Kinetic.TextPath.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.TextPath.prototype
|
||||
* @param {String} fontFamily
|
||||
*/
|
||||
|
||||
/**
|
||||
* get font family
|
||||
* @name getFontFamily
|
||||
* @methodOf Kinetic.TextPath.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.TextPath.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.TextPath, 'fontSize', 12);
|
||||
@@ -332,14 +332,16 @@
|
||||
/**
|
||||
* set font size
|
||||
* @name setFontSize
|
||||
* @methodOf Kinetic.TextPath.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.TextPath.prototype
|
||||
* @param {int} fontSize
|
||||
*/
|
||||
|
||||
/**
|
||||
* get font size
|
||||
* @name getFontSize
|
||||
* @methodOf Kinetic.TextPath.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.TextPath.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.TextPath, 'fontStyle', NORMAL);
|
||||
@@ -347,14 +349,16 @@
|
||||
/**
|
||||
* set font style. Can be 'normal', 'italic', or 'bold'. 'normal' is the default.
|
||||
* @name setFontStyle
|
||||
* @methodOf Kinetic.TextPath.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.TextPath.prototype
|
||||
* @param {String} fontStyle
|
||||
*/
|
||||
|
||||
/**
|
||||
* get font style
|
||||
* @name getFontStyle
|
||||
* @methodOf Kinetic.TextPath.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.TextPath.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetter(Kinetic.TextPath, 'text', EMPTY_STRING);
|
||||
@@ -362,6 +366,7 @@
|
||||
/**
|
||||
* get text
|
||||
* @name getText
|
||||
* @methodOf Kinetic.TextPath.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.TextPath.prototype
|
||||
*/
|
||||
})();
|
||||
|
@@ -1,8 +1,9 @@
|
||||
(function() {
|
||||
/**
|
||||
* Blob constructor. Blobs are defined by an array of points and
|
||||
* Blob constructor. Blobs are defined by an array of points and
|
||||
* a tension
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Spline
|
||||
* @param {Object} config
|
||||
* @param {Array} config.points can be a flattened array of points, an array of point arrays, or an array of point objects.
|
||||
|
@@ -2,6 +2,7 @@
|
||||
/**
|
||||
* Circle constructor
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {Number} config.radius
|
||||
@@ -49,14 +50,14 @@
|
||||
|
||||
/**
|
||||
* set radius
|
||||
* @name setRadius
|
||||
* @methodOf Kinetic.Circle.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Circle.prototype
|
||||
* @param {Number} radius
|
||||
*/
|
||||
|
||||
/**
|
||||
* get radius
|
||||
* @name getRadius
|
||||
* @methodOf Kinetic.Circle.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Circle.prototype
|
||||
*/
|
||||
})();
|
||||
|
@@ -7,6 +7,7 @@
|
||||
/**
|
||||
* Image constructor
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {ImageObject} config.image
|
||||
@@ -99,11 +100,6 @@
|
||||
canvas.fillStroke(this);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* apply filter
|
||||
* @name applyFilter
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
*/
|
||||
applyFilter: function() {
|
||||
var image = this.getImage(),
|
||||
that = this,
|
||||
@@ -137,8 +133,8 @@
|
||||
},
|
||||
/**
|
||||
* clear filter
|
||||
* @name clearFilter
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
*/
|
||||
clearFilter: function() {
|
||||
this.filterCanvas = null;
|
||||
@@ -146,8 +142,8 @@
|
||||
},
|
||||
/**
|
||||
* set crop
|
||||
* @name setCrop
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
* @param {Object|Array} config
|
||||
* @param {Number} config.x
|
||||
* @param {Number} config.y
|
||||
@@ -165,8 +161,8 @@
|
||||
/**
|
||||
* create image hit region which enables more accurate hit detection mapping of the image
|
||||
* by avoiding event detections for transparent pixels
|
||||
* @name createImageHitRegion
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
* @param {Function} [callback] callback function to be called once
|
||||
* the image hit region has been created
|
||||
*/
|
||||
@@ -211,8 +207,8 @@
|
||||
},
|
||||
/**
|
||||
* clear image hit region
|
||||
* @name clearImageHitRegion
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
*/
|
||||
clearImageHitRegion: function() {
|
||||
delete this.imageHitRegion;
|
||||
@@ -258,14 +254,16 @@
|
||||
/**
|
||||
* set image
|
||||
* @name setImage
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
* @param {ImageObject} image
|
||||
*/
|
||||
|
||||
/**
|
||||
* get image
|
||||
* @name getImage
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetter(Kinetic.Image, 'crop');
|
||||
@@ -273,7 +271,8 @@
|
||||
/**
|
||||
* get crop
|
||||
* @name getCrop
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addFilterGetterSetter(Kinetic.Image, 'filter');
|
||||
@@ -281,13 +280,15 @@
|
||||
/**
|
||||
* set filter
|
||||
* @name setFilter
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
* @param {Function} filter
|
||||
*/
|
||||
|
||||
/**
|
||||
* get filter
|
||||
* @name getFilter
|
||||
* @methodOf Kinetic.Image.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Image.prototype
|
||||
*/
|
||||
})();
|
||||
|
@@ -2,6 +2,7 @@
|
||||
/**
|
||||
* Line constructor. Lines are defined by an array of points
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {Array} config.points can be a flattened array of points, an array of point arrays, or an array of point objects.
|
||||
@@ -36,8 +37,8 @@
|
||||
},
|
||||
/**
|
||||
* set points array
|
||||
* @name setPoints
|
||||
* @methodOf Kinetic.Line.prototype
|
||||
* @method
|
||||
* @memberof 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]
|
||||
*/
|
||||
@@ -46,8 +47,8 @@
|
||||
},
|
||||
/**
|
||||
* get points array
|
||||
* @name getPoints
|
||||
* @methodOf Kinetic.Line.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Line.prototype
|
||||
*/
|
||||
// NOTE: cannot use getter method because we need to return a new
|
||||
// default array literal each time because arrays are modified by reference
|
||||
|
@@ -2,6 +2,7 @@
|
||||
/**
|
||||
* Polygon constructor. Polygons are defined by an array of points
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {Array} config.points can be a flattened array of points, an array of point arrays, or an array of point objects.
|
||||
@@ -34,8 +35,8 @@
|
||||
},
|
||||
/**
|
||||
* set points array
|
||||
* @name setPoints
|
||||
* @methodOf Kinetic.Polygon.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Polygon.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]
|
||||
*/
|
||||
@@ -44,8 +45,8 @@
|
||||
},
|
||||
/**
|
||||
* get points array
|
||||
* @name getPoints
|
||||
* @methodOf Kinetic.Polygon.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Polygon.prototype
|
||||
*/
|
||||
// NOTE: cannot use getter method because we need to return a new
|
||||
// default array literal each time because arrays are modified by reference
|
||||
|
@@ -2,6 +2,7 @@
|
||||
/**
|
||||
* Rect constructor
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {Number} [config.cornerRadius]
|
||||
@@ -55,14 +56,16 @@
|
||||
/**
|
||||
* set corner radius
|
||||
* @name setCornerRadius
|
||||
* @methodOf Kinetic.Rect.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Rect.prototype
|
||||
* @param {Number} corner radius
|
||||
*/
|
||||
|
||||
/**
|
||||
* get corner radius
|
||||
* @name getCornerRadius
|
||||
* @methodOf Kinetic.Rect.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Rect.prototype
|
||||
*/
|
||||
|
||||
})();
|
||||
|
@@ -3,6 +3,7 @@
|
||||
* Spline constructor. Splines are defined by an array of points and
|
||||
* a tension
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Line
|
||||
* @param {Object} config
|
||||
* @param {Array} config.points can be a flattened array of points, an array of point arrays, or an array of point objects.
|
||||
@@ -79,8 +80,8 @@
|
||||
},
|
||||
/**
|
||||
* set tension
|
||||
* @name setTension
|
||||
* @methodOf Kinetic.Spline.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Spline.prototype
|
||||
* @param {Number} tension
|
||||
*/
|
||||
setTension: function(tension) {
|
||||
@@ -108,6 +109,7 @@
|
||||
/**
|
||||
* get tension
|
||||
* @name getTension
|
||||
* @methodOf Kinetic.Spline.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Spline.prototype
|
||||
*/
|
||||
})();
|
||||
|
@@ -2,6 +2,7 @@
|
||||
/**
|
||||
* Sprite constructor
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {String} config.animation animation key
|
||||
@@ -55,8 +56,8 @@
|
||||
},
|
||||
/**
|
||||
* start sprite animation
|
||||
* @name start
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
*/
|
||||
start: function() {
|
||||
var that = this;
|
||||
@@ -84,8 +85,8 @@
|
||||
},
|
||||
/**
|
||||
* stop sprite animation
|
||||
* @name stop
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
*/
|
||||
stop: function() {
|
||||
this.anim.stop();
|
||||
@@ -93,8 +94,8 @@
|
||||
},
|
||||
/**
|
||||
* set after frame event handler
|
||||
* @name afterFrame
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
* @param {Integer} index frame index
|
||||
* @param {Function} func function to be executed after frame has been drawn
|
||||
*/
|
||||
@@ -125,14 +126,16 @@
|
||||
/**
|
||||
* set animation key
|
||||
* @name setAnimation
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
* @param {String} anim animation key
|
||||
*/
|
||||
|
||||
/**
|
||||
* get animation key
|
||||
* @name getAnimation
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'animations');
|
||||
@@ -140,14 +143,16 @@
|
||||
/**
|
||||
* set animations map
|
||||
* @name setAnimations
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
* @param {Object} animations
|
||||
*/
|
||||
|
||||
/**
|
||||
* get animations map
|
||||
* @name getAnimations
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'image');
|
||||
@@ -155,14 +160,16 @@
|
||||
/**
|
||||
* set image
|
||||
* @name setImage
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
* @param {Image} image
|
||||
*/
|
||||
|
||||
/**
|
||||
* get image
|
||||
* @name getImage
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'index', 0);
|
||||
@@ -170,14 +177,16 @@
|
||||
/**
|
||||
* set animation frame index
|
||||
* @name setIndex
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
* @param {Integer} index frame index
|
||||
*/
|
||||
|
||||
/**
|
||||
* get animation frame index
|
||||
* @name getIndex
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Sprite, 'frameRate', 17);
|
||||
@@ -186,14 +195,16 @@
|
||||
* set frame rate in frames / second. Default is 17 frames per second. Increase this number to make the sprite
|
||||
* animation run faster, and decrease the number to make the sprite animation run slower
|
||||
* @name setFrameRate
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
* @param {Integer} frameRate
|
||||
*/
|
||||
|
||||
/**
|
||||
* get frame rate
|
||||
* @name getFrameRate
|
||||
* @methodOf Kinetic.Sprite.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Sprite.prototype
|
||||
*/
|
||||
|
||||
})();
|
||||
|
@@ -30,6 +30,7 @@
|
||||
/**
|
||||
* Text constructor
|
||||
* @constructor
|
||||
* @memberof Kinetic
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
* @param {String} [config.fontFamily] default is Calibri
|
||||
@@ -134,8 +135,8 @@
|
||||
},
|
||||
/**
|
||||
* set text
|
||||
* @name setText
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
* @param {String} text
|
||||
*/
|
||||
setText: function(text) {
|
||||
@@ -144,32 +145,32 @@
|
||||
},
|
||||
/**
|
||||
* get width
|
||||
* @name getWidth
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
getWidth: function() {
|
||||
return this.attrs.width === AUTO ? this.getTextWidth() + this.getPadding() * 2 : this.attrs.width;
|
||||
},
|
||||
/**
|
||||
* get height
|
||||
* @name getHeight
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
getHeight: function() {
|
||||
return this.attrs.height === AUTO ? (this.getTextHeight() * this.textArr.length * this.getLineHeight()) + this.getPadding() * 2 : this.attrs.height;
|
||||
},
|
||||
/**
|
||||
* get text width
|
||||
* @name getTextWidth
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
getTextWidth: function() {
|
||||
return this.textWidth;
|
||||
},
|
||||
/**
|
||||
* get text height
|
||||
* @name getTextHeight
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
getTextHeight: function() {
|
||||
return this.textHeight;
|
||||
@@ -198,10 +199,6 @@
|
||||
_getTextWidth: function (text) {
|
||||
return dummyContext.measureText(text).width;
|
||||
},
|
||||
/**
|
||||
* set text data. wrap logic and width and height setting occurs
|
||||
* here
|
||||
*/
|
||||
_setTextData: function () {
|
||||
var lines = this.getText().split('\n'),
|
||||
fontSize = +this.getFontSize(),
|
||||
@@ -317,14 +314,16 @@
|
||||
/**
|
||||
* set font family
|
||||
* @name setFontFamily
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
* @param {String} fontFamily
|
||||
*/
|
||||
|
||||
/**
|
||||
* get font family
|
||||
* @name getFontFamily
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Text, 'fontSize', 12);
|
||||
@@ -332,14 +331,16 @@
|
||||
/**
|
||||
* set font size in pixels
|
||||
* @name setFontSize
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
* @param {int} fontSize
|
||||
*/
|
||||
|
||||
/**
|
||||
* get font size
|
||||
* @name getFontSize
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Text, 'fontStyle', NORMAL);
|
||||
@@ -347,14 +348,16 @@
|
||||
/**
|
||||
* set font style. Can be 'normal', 'italic', or 'bold'. 'normal' is the default.
|
||||
* @name setFontStyle
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
* @param {String} fontStyle
|
||||
*/
|
||||
|
||||
/**
|
||||
* get font style
|
||||
* @name getFontStyle
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Text, 'padding', 0);
|
||||
@@ -362,14 +365,16 @@
|
||||
/**
|
||||
* set padding
|
||||
* @name setPadding
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
* @param {int} padding
|
||||
*/
|
||||
|
||||
/**
|
||||
* get padding
|
||||
* @name getPadding
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Text, 'align', LEFT);
|
||||
@@ -377,14 +382,16 @@
|
||||
/**
|
||||
* set horizontal align of text
|
||||
* @name setAlign
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
* @param {String} align align can be 'left', 'center', or 'right'
|
||||
*/
|
||||
|
||||
/**
|
||||
* get horizontal align
|
||||
* @name getAlign
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Text, 'lineHeight', 1);
|
||||
@@ -392,14 +399,16 @@
|
||||
/**
|
||||
* set line height
|
||||
* @name setLineHeight
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
* @param {Number} lineHeight default is 1
|
||||
*/
|
||||
|
||||
/**
|
||||
* get line height
|
||||
* @name getLineHeight
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Text, 'wrap', WORD);
|
||||
@@ -407,14 +416,16 @@
|
||||
/**
|
||||
* set wrap
|
||||
* @name setWrap
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
* @param {String} wrap can be word, char, or none. Default is word
|
||||
*/
|
||||
|
||||
/**
|
||||
* get wrap
|
||||
* @name getWrap
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetter(Kinetic.Text, TEXT, EMPTY_STRING);
|
||||
@@ -422,7 +433,8 @@
|
||||
/**
|
||||
* get text
|
||||
* @name getText
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addSetter(Kinetic.Text, 'width');
|
||||
@@ -430,7 +442,8 @@
|
||||
/**
|
||||
* set width
|
||||
* @name setWidth
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
* @param {Number|String} width default is auto
|
||||
*/
|
||||
|
||||
@@ -439,7 +452,8 @@
|
||||
/**
|
||||
* set height
|
||||
* @name setHeight
|
||||
* @methodOf Kinetic.Text.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Text.prototype
|
||||
* @param {Number|String} height default is auto
|
||||
*/
|
||||
})();
|
||||
|
@@ -31,12 +31,6 @@
|
||||
context.lineTo(0, 0);
|
||||
context.closePath();
|
||||
canvas.fillStroke(this);
|
||||
},
|
||||
setAngleDeg: function(deg) {
|
||||
this.setAngle(Kinetic.Util._degToRad(deg));
|
||||
},
|
||||
getAngleDeg: function() {
|
||||
return Kinetic.Util._radToDeg(this.getAngle());
|
||||
}
|
||||
};
|
||||
Kinetic.Util.extend(Kinetic.Wedge, Kinetic.Shape);
|
||||
@@ -47,14 +41,16 @@
|
||||
/**
|
||||
* set radius
|
||||
* @name setRadius
|
||||
* @methodOf Kinetic.Wedge.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Wedge.prototype
|
||||
* @param {Number} radius
|
||||
*/
|
||||
|
||||
/**
|
||||
* get radius
|
||||
* @name getRadius
|
||||
* @methodOf Kinetic.Wedge.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Wedge.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addRotationGetterSetter(Kinetic.Wedge, 'angle', 0);
|
||||
@@ -62,27 +58,31 @@
|
||||
/**
|
||||
* set angle
|
||||
* @name setAngle
|
||||
* @methodOf Kinetic.Wedge.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Wedge.prototype
|
||||
* @param {Number} angle
|
||||
*/
|
||||
|
||||
/**
|
||||
* set angle in degrees
|
||||
* @name setAngleDeg
|
||||
* @methodOf Kinetic.Wedge.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Wedge.prototype
|
||||
* @param {Number} angleDeg
|
||||
*/
|
||||
|
||||
/**
|
||||
* get angle
|
||||
* @name getAngle
|
||||
* @methodOf Kinetic.Wedge.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Wedge.prototype
|
||||
*/
|
||||
|
||||
/**
|
||||
* get angle in degrees
|
||||
* @name getAngleDeg
|
||||
* @methodOf Kinetic.Wedge.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Wedge.prototype
|
||||
*/
|
||||
|
||||
Kinetic.Node.addGetterSetter(Kinetic.Wedge, 'clockwise', false);
|
||||
@@ -91,13 +91,15 @@
|
||||
* 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.
|
||||
* @name setClockwise
|
||||
* @methodOf Kinetic.Wedge.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Wedge.prototype
|
||||
* @param {Boolean} clockwise
|
||||
*/
|
||||
|
||||
/**
|
||||
* get clockwise
|
||||
* @name getClockwise
|
||||
* @methodOf Kinetic.Wedge.prototype
|
||||
* @method
|
||||
* @memberof Kinetic.Wedge.prototype
|
||||
*/
|
||||
})();
|
||||
|
Reference in New Issue
Block a user