mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 06:55:17 +08:00
Merge branch 'customextend'
This commit is contained in:
commit
45cf237ce0
2
Thorfile
2
Thorfile
@ -6,7 +6,7 @@ class Build < Thor
|
||||
"license.js", "src/Global.js", "src/Transition.js", "src/filters/Grayscale.js",
|
||||
"src/util/Type.js", "src/util/Canvas.js", "src/util/Class.js", "src/util/Tween.js", "src/util/Transform.js",
|
||||
"src/Animation.js", "src/Node.js", "src/Container.js", "src/Stage.js", "src/Layer.js", "src/Group.js", "src/Shape.js",
|
||||
"src/shapes/Rect.js", "src/shapes/Ellipse.js", "src/shapes/Image.js", "src/shapes/Polygon.js", "src/shapes/Text.js", "src/shapes/Line.js", "src/shapes/Sprite.js", "src/shapes/Star.js", "src/shapes/RegularPolygon.js", "src/shapes/Path.js", "src/shapes/TextPath.js"
|
||||
"src/shapes/Rect.js" #, "src/shapes/Ellipse.js", "src/shapes/Image.js", "src/shapes/Polygon.js", "src/shapes/Text.js", "src/shapes/Line.js", "src/shapes/Sprite.js", "src/shapes/Star.js", "src/shapes/RegularPolygon.js", "src/shapes/Path.js", "src/shapes/TextPath.js"
|
||||
]
|
||||
|
||||
desc "dev", "Concatenate all the js files into /dist/kinetic-VERSION.js."
|
||||
|
2209
dist/kinetic-core.js
vendored
2209
dist/kinetic-core.js
vendored
File diff suppressed because it is too large
Load Diff
4
dist/kinetic-core.min.js
vendored
4
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
@ -30,10 +30,14 @@
|
||||
* @param {Number} [config.dragBounds.bottom]
|
||||
* @param {Number} [config.dragBounds.left]
|
||||
*/
|
||||
Kinetic.Container = Kinetic.Node.extend({
|
||||
init: function(config) {
|
||||
Kinetic.Container = function(config) {
|
||||
this._containerInit(config);
|
||||
};
|
||||
|
||||
Kinetic.Container.prototype = {
|
||||
_containerInit: function(config) {
|
||||
this.children = [];
|
||||
this._super(config);
|
||||
Kinetic.Node.call(this, config);
|
||||
},
|
||||
/**
|
||||
* get children
|
||||
@ -234,4 +238,5 @@ Kinetic.Container = Kinetic.Node.extend({
|
||||
this.children[n].index = n;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
Kinetic.Global.extend(Kinetic.Container, Kinetic.Node);
|
||||
|
@ -31,6 +31,13 @@ Kinetic.Global = {
|
||||
console.warn('Kinetic warning: ' + str);
|
||||
}
|
||||
},
|
||||
extend: function(c1, c2) {
|
||||
for(var key in c2.prototype) {
|
||||
if(!( key in c1.prototype)) {
|
||||
c1.prototype[key] = c2.prototype[key];
|
||||
}
|
||||
}
|
||||
},
|
||||
_pullNodes: function(stage) {
|
||||
var tempNodes = this.tempNodes;
|
||||
for(var key in tempNodes) {
|
||||
|
13
src/Group.js
13
src/Group.js
@ -30,11 +30,16 @@
|
||||
* @param {Number} [config.dragBounds.bottom]
|
||||
* @param {Number} [config.dragBounds.left]
|
||||
*/
|
||||
Kinetic.Group = Kinetic.Container.extend({
|
||||
init: function(config) {
|
||||
Kinetic.Group = function(config) {
|
||||
this._groupInit(config);
|
||||
};
|
||||
|
||||
Kinetic.Group.prototype = {
|
||||
_groupInit: function(config) {
|
||||
this.nodeType = 'Group';
|
||||
|
||||
// call super constructor
|
||||
this._super(config);
|
||||
Kinetic.Container.call(this, config);
|
||||
}
|
||||
});
|
||||
};
|
||||
Kinetic.Global.extend(Kinetic.Group, Kinetic.Container);
|
||||
|
13
src/Layer.js
13
src/Layer.js
@ -33,8 +33,12 @@
|
||||
* @param {Number} [config.dragBounds.bottom]
|
||||
* @param {Number} [config.dragBounds.left]
|
||||
*/
|
||||
Kinetic.Layer = Kinetic.Container.extend({
|
||||
init: function(config) {
|
||||
Kinetic.Layer = function(config) {
|
||||
this._layerInit(config);
|
||||
};
|
||||
|
||||
Kinetic.Layer.prototype = {
|
||||
_layerInit: function(config) {
|
||||
this.setDefaultAttrs({
|
||||
clearBeforeDraw: true
|
||||
});
|
||||
@ -48,7 +52,7 @@ Kinetic.Layer = Kinetic.Container.extend({
|
||||
this.bufferCanvas.name = 'buffer';
|
||||
|
||||
// call super constructor
|
||||
this._super(config);
|
||||
Kinetic.Container.call(this, config);
|
||||
},
|
||||
/**
|
||||
* draw children nodes. this includes any groups
|
||||
@ -171,7 +175,8 @@ Kinetic.Layer = Kinetic.Container.extend({
|
||||
canvas.clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
Kinetic.Global.extend(Kinetic.Layer, Kinetic.Container);
|
||||
|
||||
// add getters and setters
|
||||
Kinetic.Node.addGettersSetters(Kinetic.Layer, ['clearBeforeDraw']);
|
||||
|
10
src/Node.js
10
src/Node.js
@ -31,8 +31,12 @@
|
||||
* @param {Number} [config.dragBounds.bottom]
|
||||
* @param {Number} [config.dragBounds.left]
|
||||
*/
|
||||
Kinetic.Node = Kinetic.Class.extend({
|
||||
init: function(config) {
|
||||
Kinetic.Node = function(config) {
|
||||
this._nodeInit(config);
|
||||
};
|
||||
|
||||
Kinetic.Node.prototype = {
|
||||
_nodeInit: function(config) {
|
||||
this.defaultNodeAttrs = {
|
||||
visible: true,
|
||||
listening: true,
|
||||
@ -1003,7 +1007,7 @@ Kinetic.Node = Kinetic.Class.extend({
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// add getter and setter methods
|
||||
Kinetic.Node.addSetters = function(constructor, arr) {
|
||||
|
13
src/Shape.js
13
src/Shape.js
@ -59,8 +59,12 @@
|
||||
* @param {Number} [config.dragBounds.bottom]
|
||||
* @param {Number} [config.dragBounds.left]
|
||||
*/
|
||||
Kinetic.Shape = Kinetic.Node.extend({
|
||||
init: function(config) {
|
||||
Kinetic.Shape = function(config) {
|
||||
this._shapeInit(config);
|
||||
};
|
||||
|
||||
Kinetic.Shape.prototype = {
|
||||
_shapeInit: function(config) {
|
||||
this.nodeType = 'Shape';
|
||||
this.appliedShadow = false;
|
||||
|
||||
@ -77,7 +81,7 @@ Kinetic.Shape = Kinetic.Node.extend({
|
||||
shapes[key] = this;
|
||||
|
||||
// call super constructor
|
||||
this._super(config);
|
||||
Kinetic.Node.call(this, config);
|
||||
},
|
||||
/**
|
||||
* get canvas context tied to the layer
|
||||
@ -415,7 +419,8 @@ Kinetic.Shape = Kinetic.Node.extend({
|
||||
context.restore();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
Kinetic.Global.extend(Kinetic.Shape, Kinetic.Node);
|
||||
|
||||
// add getters and setters
|
||||
Kinetic.Node.addGettersSetters(Kinetic.Shape, ['fill', 'stroke', 'lineJoin', 'strokeWidth', 'shadow', 'drawFunc', 'filter']);
|
||||
|
13
src/Stage.js
13
src/Stage.js
@ -33,8 +33,12 @@
|
||||
* @param {Number} [config.dragBounds.bottom]
|
||||
* @param {Number} [config.dragBounds.left]
|
||||
*/
|
||||
Kinetic.Stage = Kinetic.Container.extend({
|
||||
init: function(config) {
|
||||
Kinetic.Stage = function(config) {
|
||||
this._stageInit(config);
|
||||
};
|
||||
|
||||
Kinetic.Stage.prototype = {
|
||||
_stageInit: function(config) {
|
||||
this.setDefaultAttrs({
|
||||
width: 400,
|
||||
height: 200
|
||||
@ -49,7 +53,7 @@ Kinetic.Stage = Kinetic.Container.extend({
|
||||
}
|
||||
|
||||
// call super constructor
|
||||
this._super(config);
|
||||
Kinetic.Container.call(this, config);
|
||||
|
||||
this._setStageDefaultProperties();
|
||||
this._id = Kinetic.Global.idCounter++;
|
||||
@ -812,7 +816,8 @@ Kinetic.Stage = Kinetic.Container.extend({
|
||||
this.names = {};
|
||||
this.dragAnim = new Kinetic.Animation();
|
||||
}
|
||||
});
|
||||
};
|
||||
Kinetic.Global.extend(Kinetic.Stage, Kinetic.Container);
|
||||
|
||||
// add getters and setters
|
||||
Kinetic.Node.addGettersSetters(Kinetic.Stage, ['width', 'height']);
|
||||
|
@ -7,8 +7,11 @@
|
||||
* @augments Kinetic.Shape
|
||||
* @param {Object} config
|
||||
*/
|
||||
Kinetic.Rect = Kinetic.Shape.extend({
|
||||
init: function(config) {
|
||||
Kinetic.Rect = function(config) {
|
||||
this._rectInit(config);
|
||||
}
|
||||
Kinetic.Rect.prototype = {
|
||||
_rectInit: function(config) {
|
||||
this.setDefaultAttrs({
|
||||
width: 0,
|
||||
height: 0,
|
||||
@ -16,8 +19,8 @@ Kinetic.Rect = Kinetic.Shape.extend({
|
||||
});
|
||||
this.shapeType = "Rect";
|
||||
config.drawFunc = this.drawFunc;
|
||||
// call super constructor
|
||||
this._super(config);
|
||||
|
||||
Kinetic.Shape.call(this, config);
|
||||
},
|
||||
drawFunc: function(context) {
|
||||
context.beginPath();
|
||||
@ -62,7 +65,8 @@ Kinetic.Rect = Kinetic.Shape.extend({
|
||||
height: this.attrs.height
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
Kinetic.Global.extend(Kinetic.Rect, Kinetic.Shape);
|
||||
|
||||
// add getters setters
|
||||
Kinetic.Node.addGettersSetters(Kinetic.Rect, ['width', 'height', 'cornerRadius']);
|
||||
|
Loading…
Reference in New Issue
Block a user