mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
updated docs
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
@@ -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';
|
||||
|
11
src/Layer.js
11
src/Layer.js
@@ -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';
|
||||
|
@@ -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++;
|
||||
|
@@ -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();
|
||||
}
|
||||
|
10
src/Stage.js
10
src/Stage.js
@@ -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) {
|
||||
|
@@ -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
|
||||
*/
|
||||
|
@@ -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({
|
||||
|
Reference in New Issue
Block a user