updated docs

This commit is contained in:
Eric Rowell
2013-05-08 09:44:03 -07:00
parent edc050067d
commit 032eb9e4db
8 changed files with 57 additions and 51 deletions

View File

@@ -37,26 +37,78 @@ var Kinetic = {};
*/
Kinetic.Filters = {};
/**
* Node constructor. Nodes are entities that can be transformed, layered,
* and have bound events. The stage, layers, groups, and shapes all extend Node.
* @constructor
* @param {Object} config
* {{NodeParams}}
*/
Kinetic.Node = function(config) {
this._nodeInit(config);
};
/**
* Shape constructor. Shapes are primitive objects such as rectangles,
* circles, text, lines, etc.
* @constructor
* @augments Kinetic.Node
* @param {Object} config
* {{ShapeParams}}
* {{NodeParams}}
*/
Kinetic.Shape = function(config) {
this._initShape(config);
};
/**
* Container constructor.  Containers are used to contain nodes or other containers
* @constructor
* @augments Kinetic.Node
* @param {Object} config
* {{NodeParams}}
* {{ContainerParams}}
*/
Kinetic.Container = function(config) {
this._containerInit(config);
};
/**
* Stage constructor. A stage is used to contain multiple layers
* @constructor
* @augments Kinetic.Container
* @param {Object} config
* @param {String|DomElement} config.container Container id or DOM element
* {{NodeParams}}
* {{ContainerParams}}
*/
Kinetic.Stage = function(config) {
this._initStage(config);
};
/**
* Layer constructor. Layers are tied to their own canvas element and are used
* to contain groups or shapes
* @constructor
* @augments Kinetic.Container
* @param {Object} config
* @param {Boolean} [config.clearBeforeDraw] set this property to false if you don't want
* to clear the canvas before each layer draw. The default value is true.
* {{NodeParams}}
* {{ContainerParams}}
*/
Kinetic.Layer = function(config) {
this._initLayer(config);
};
/**
* Group constructor. Groups are used to contain shapes or other groups.
* @constructor
* @augments Kinetic.Container
* @param {Object} config
* {{NodeParams}}
* {{ContainerParams}}
*/
Kinetic.Group = function(config) {
this._initGroup(config);
};

View File

@@ -1,12 +1,4 @@
(function() {
/**
* Group constructor. Groups are used to contain shapes or other groups.
* @constructor
* @augments Kinetic.Container
* @param {Object} config
* {{NodeParams}}
* {{ContainerParams}}
*/
Kinetic.Util.addMethods(Kinetic.Group, {
_initGroup: function(config) {
this.nodeType = 'Group';

View File

@@ -1,15 +1,4 @@
(function() {
/**
* Layer constructor. Layers are tied to their own canvas element and are used
* to contain groups or shapes
* @constructor
* @augments Kinetic.Container
* @param {Object} config
* @param {Boolean} [config.clearBeforeDraw] set this property to false if you don't want
* to clear the canvas before each layer draw. The default value is true.
* {{NodeParams}}
* {{ContainerParams}}
*/
Kinetic.Util.addMethods(Kinetic.Layer, {
_initLayer: function(config) {
this.nodeType = 'Layer';

View File

@@ -33,14 +33,6 @@
UPPER_B = 'B',
HASH = '#';
/**
* Node constructor. Nodes are entities that can be transformed, layered,
* and have bound events. The stage, layers, groups, and shapes all extend Node.
* @constructor
* @param {Object} config
* {{NodeParams}}
*/
Kinetic.Util.addMethods(Kinetic.Node, {
_nodeInit: function(config) {
this._id = Kinetic.Global.idCounter++;

View File

@@ -1,13 +1,4 @@
(function() {
/**
* Shape constructor. Shapes are primitive objects such as rectangles,
* circles, text, lines, etc.
* @constructor
* @augments Kinetic.Node
* @param {Object} config
* {{ShapeParams}}
* {{NodeParams}}
*/
function _fillFunc(context) {
context.fill();
}

View File

@@ -34,16 +34,6 @@
ctx['_' + eventName](evt);
}, false);
}
/**
* Stage constructor. A stage is used to contain multiple layers
* @constructor
* @augments Kinetic.Container
* @param {Object} config
* @param {String|DomElement} config.container Container id or DOM element
* {{NodeParams}}
* {{ContainerParams}}
*/
Kinetic.Util.addMethods(Kinetic.Stage, {
_initStage: function(config) {

View File

@@ -221,8 +221,8 @@
RGB_REGEX = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;
/*
* utilities that handle data type detection, conversion, and manipulation
/**
* @namespace
*/
Kinetic.Util = {
/*
@@ -597,7 +597,7 @@
},
/**
* @method addMethods adds methods to a constructor prototype
* @methodOf Kinetic.Global
* @methodOf Kinetic.Util
* @param {Function} constructor
* @param {Object} methods
*/

View File

@@ -818,7 +818,7 @@ Test.Modules.NODE = {
height: 300,
callback: function(imageObj) {
//document.body.appendChild(imageObj)
test(Kinetic.Type._isElement(imageObj), 'shape toImage() should be an image object');
test(Kinetic.Util._isElement(imageObj), 'shape toImage() should be an image object');
var cachedShape = new Kinetic.Image({
image: imageObj,
@@ -2758,7 +2758,7 @@ Test.Modules.NODE = {
group.hide();
layer.draw();
test(layer.toDataURL() === dataUrls['cleared'], 'group is still visible');
testDataUrl(layer.toDataURL(), 'cleared', 'group is still visible');
},
'test getNodeType()': function(containerId) {
var stage = new Kinetic.Stage({