2012-11-27 12:42:01 +08:00
|
|
|
(function() {
|
2012-03-07 13:45:48 +08:00
|
|
|
/**
|
2012-11-14 14:54:08 +08:00
|
|
|
* Shape constructor. Shapes are primitive objects such as rectangles,
|
|
|
|
* circles, text, lines, etc.
|
|
|
|
* @constructor
|
|
|
|
* @augments Kinetic.Node
|
|
|
|
* @param {Object} config
|
|
|
|
* @config {String|Object} [config.fill] can be a string color, a linear gradient object, a radial
|
|
|
|
* gradient object, or a pattern object.
|
|
|
|
* @config {Image} [config.fill.image] image object if filling the shape with a pattern
|
|
|
|
* @config {Object} [config.fill.offset] pattern offset if filling the shape with a pattern
|
|
|
|
* @config {Number} [config.fill.offset.x]
|
|
|
|
* @config {Number} [config.fill.offset.y]
|
|
|
|
* @config {Object} [config.fill.start] start point if using a linear gradient or
|
|
|
|
* radial gradient fill
|
|
|
|
* @config {Number} [config.fill.start.x]
|
|
|
|
* @config {Number} [config.fill.start.y]
|
|
|
|
* @config {Number} [config.fill.start.radius] start radius if using a radial gradient fill
|
|
|
|
* @config {Object} [config.fill.end] end point if using a linear gradient or
|
|
|
|
* radial gradient fill
|
|
|
|
* @config {Number} [config.fill.end.x]
|
|
|
|
* @config {Number} [config.fill.end.y]
|
|
|
|
* @config {Number} [config.fill.end.radius] end radius if using a radial gradient fill
|
|
|
|
* @config {String} [config.stroke] stroke color
|
|
|
|
* @config {Number} [config.strokeWidth] stroke width
|
|
|
|
* @config {String} [config.lineJoin] line join can be miter, round, or bevel. The default
|
|
|
|
* is miter
|
|
|
|
* @config {Object} [config.shadow] shadow object
|
|
|
|
* @config {String} [config.shadow.color]
|
|
|
|
* @config {Number} [config.shadow.blur]
|
|
|
|
* @config {Obect} [config.shadow.blur.offset]
|
|
|
|
* @config {Number} [config.shadow.blur.offset.x]
|
|
|
|
* @config {Number} [config.shadow.blur.offset.y]
|
|
|
|
* @config {Number} [config.shadow.opacity] shadow opacity. Can be any real number
|
|
|
|
* between 0 and 1
|
|
|
|
* @param {Number} [config.x]
|
|
|
|
* @param {Number} [config.y]
|
|
|
|
* @param {Boolean} [config.visible]
|
|
|
|
* @param {Boolean} [config.listening] whether or not the node is listening for events
|
|
|
|
* @param {String} [config.id] unique id
|
|
|
|
* @param {String} [config.name] non-unique name
|
|
|
|
* @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1
|
|
|
|
* @param {Object} [config.scale]
|
|
|
|
* @param {Number} [config.scale.x]
|
|
|
|
* @param {Number} [config.scale.y]
|
|
|
|
* @param {Number} [config.rotation] rotation in radians
|
|
|
|
* @param {Number} [config.rotationDeg] rotation in degrees
|
|
|
|
* @param {Object} [config.offset] offsets default position point and rotation point
|
|
|
|
* @param {Number} [config.offset.x]
|
|
|
|
* @param {Number} [config.offset.y]
|
|
|
|
* @param {Boolean} [config.draggable]
|
|
|
|
* @param {String} [config.dragConstraint] can be vertical, horizontal, or none. The default
|
|
|
|
* is none
|
|
|
|
* @param {Object} [config.dragBounds]
|
|
|
|
* @param {Number} [config.dragBounds.top]
|
|
|
|
* @param {Number} [config.dragBounds.right]
|
|
|
|
* @param {Number} [config.dragBounds.bottom]
|
|
|
|
* @param {Number} [config.dragBounds.left]
|
2012-04-29 12:12:01 +08:00
|
|
|
*/
|
2012-11-27 12:42:01 +08:00
|
|
|
Kinetic.Shape = function(config) {
|
2012-11-14 14:54:08 +08:00
|
|
|
this._initShape(config);
|
|
|
|
};
|
2012-04-29 12:12:01 +08:00
|
|
|
|
2012-11-27 12:42:01 +08:00
|
|
|
Kinetic.Shape.prototype = {
|
2012-11-14 14:54:08 +08:00
|
|
|
_initShape: function(config) {
|
|
|
|
this.nodeType = 'Shape';
|
2012-05-27 11:34:36 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
// set colorKey
|
|
|
|
var shapes = Kinetic.Global.shapes;
|
|
|
|
var key;
|
2012-11-15 13:55:16 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
while(true) {
|
2012-11-14 15:48:30 +08:00
|
|
|
key = Kinetic.Type._getRandomColorKey();
|
2012-11-14 14:54:08 +08:00
|
|
|
if(key && !( key in shapes)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-11-15 13:55:16 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
this.colorKey = key;
|
|
|
|
shapes[key] = this;
|
|
|
|
|
|
|
|
// call super constructor
|
|
|
|
Kinetic.Node.call(this, config);
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* get canvas context tied to the layer
|
|
|
|
* @name getContext
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
getContext: function() {
|
|
|
|
return this.getLayer().getContext();
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* get canvas tied to the layer
|
|
|
|
* @name getCanvas
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
getCanvas: function() {
|
|
|
|
return this.getLayer().getCanvas();
|
|
|
|
},
|
|
|
|
_getFillType: function(fill) {
|
2012-11-15 13:55:16 +08:00
|
|
|
var type = Kinetic.Type;
|
2012-11-14 14:54:08 +08:00
|
|
|
if(!fill) {
|
|
|
|
return undefined;
|
|
|
|
}
|
2012-11-14 15:48:30 +08:00
|
|
|
else if(type._isString(fill)) {
|
2012-11-14 14:54:08 +08:00
|
|
|
return 'COLOR';
|
|
|
|
}
|
|
|
|
else if(fill.image) {
|
|
|
|
return 'PATTERN';
|
|
|
|
}
|
|
|
|
else if(fill.start && fill.end && !fill.start.radius && !fill.end.radius) {
|
|
|
|
return 'LINEAR_GRADIENT';
|
|
|
|
}
|
2012-11-14 15:48:30 +08:00
|
|
|
else if(fill.start && fill.end && type._isNumber(fill.start.radius) && type._isNumber(fill.end.radius)) {
|
2012-11-14 14:54:08 +08:00
|
|
|
return 'RADIAL_GRADIENT';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return 'UNKNOWN';
|
|
|
|
}
|
|
|
|
},
|
2012-11-21 15:03:24 +08:00
|
|
|
/**
|
2012-11-24 06:54:32 +08:00
|
|
|
* fill current path
|
|
|
|
* @name fill
|
2012-11-21 15:03:24 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
2012-11-24 06:54:32 +08:00
|
|
|
fill: function(context) {
|
|
|
|
context.renderer._fill(this);
|
2012-11-21 15:03:24 +08:00
|
|
|
},
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
2012-11-24 06:54:32 +08:00
|
|
|
* stroke current path
|
|
|
|
* @name stroke
|
2012-11-14 14:54:08 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-11-21 15:03:24 +08:00
|
|
|
*/
|
2012-11-24 06:54:32 +08:00
|
|
|
stroke: function(context) {
|
|
|
|
context.renderer._stroke(this);
|
2012-11-14 14:54:08 +08:00
|
|
|
},
|
2012-11-24 06:54:32 +08:00
|
|
|
/**
|
|
|
|
* fill and stroke current path. Aside from being a convenience method
|
|
|
|
* which fills and strokes the current path with a single method, its main purpose is
|
|
|
|
* to ensure that the shadow object is not applied to both the fill and stroke. A shadow
|
|
|
|
* will only be applied to either the fill or stroke. Fill
|
|
|
|
* is given priority over stroke.
|
|
|
|
* @name fillStroke
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
fillStroke: function(context) {
|
|
|
|
context.renderer._fill(this);
|
|
|
|
context.renderer._stroke(this, this.getShadow() && this.getFill());
|
2012-11-14 14:54:08 +08:00
|
|
|
},
|
|
|
|
/**
|
2012-11-24 06:54:32 +08:00
|
|
|
* draw an image
|
2012-11-14 14:54:08 +08:00
|
|
|
* @name drawImage
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
drawImage: function() {
|
|
|
|
var context = arguments[0];
|
2012-07-22 12:09:02 +08:00
|
|
|
context.save();
|
2012-11-14 14:54:08 +08:00
|
|
|
var a = Array.prototype.slice.call(arguments);
|
|
|
|
|
|
|
|
if(a.length === 6 || a.length === 10) {
|
|
|
|
if(a.length === 6) {
|
|
|
|
context.drawImage(a[1], a[2], a[3], a[4], a[5]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
context.drawImage(a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]);
|
|
|
|
}
|
2012-05-27 11:34:36 +08:00
|
|
|
}
|
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
context.restore();
|
|
|
|
},
|
2012-11-24 06:54:32 +08:00
|
|
|
_applyOpacity: function(context) {
|
2012-11-14 14:54:08 +08:00
|
|
|
var absOpacity = this.getAbsoluteOpacity();
|
|
|
|
if(absOpacity !== 1) {
|
|
|
|
context.globalAlpha = absOpacity;
|
|
|
|
}
|
|
|
|
},
|
2012-11-24 06:54:32 +08:00
|
|
|
_applyLineJoin: function(context) {
|
|
|
|
var lineJoin = this.getLineJoin();
|
2012-11-14 16:07:59 +08:00
|
|
|
if(lineJoin) {
|
|
|
|
context.lineJoin = lineJoin;
|
2012-11-14 14:54:08 +08:00
|
|
|
}
|
|
|
|
},
|
2012-11-24 06:54:32 +08:00
|
|
|
_applyLineCap: function(context) {
|
|
|
|
var lineCap = this.getLineCap();
|
2012-11-14 16:07:59 +08:00
|
|
|
if(lineCap) {
|
|
|
|
context.lineCap = lineCap;
|
2012-11-14 14:54:08 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* set shadow object
|
|
|
|
* @name setShadow
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Object} config
|
|
|
|
* @param {String} config.color
|
|
|
|
* @param {Number} config.blur
|
|
|
|
* @param {Array|Object|Number} config.offset
|
|
|
|
* @param {Number} config.opacity
|
|
|
|
*/
|
|
|
|
setShadow: function(config) {
|
2012-11-15 13:55:16 +08:00
|
|
|
var type = Kinetic.Type;
|
2012-11-14 14:54:08 +08:00
|
|
|
if(config.offset !== undefined) {
|
2012-11-14 15:48:30 +08:00
|
|
|
config.offset = type._getXY(config.offset);
|
2012-11-14 14:54:08 +08:00
|
|
|
}
|
2012-11-14 15:48:30 +08:00
|
|
|
this.setAttr('shadow', type._merge(config, this.getShadow()));
|
2012-11-14 14:54:08 +08:00
|
|
|
},
|
|
|
|
/**
|
|
|
|
* set fill which can be a color, linear gradient object,
|
|
|
|
* radial gradient object, or pattern object
|
|
|
|
* @name setFill
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {String|Object} fill
|
|
|
|
*/
|
|
|
|
setFill: function(fill) {
|
2012-11-15 13:55:16 +08:00
|
|
|
var type = Kinetic.Type;
|
2012-11-14 14:54:08 +08:00
|
|
|
var oldFill = this.getFill();
|
|
|
|
var fillType = this._getFillType(fill);
|
|
|
|
var oldFillType = this._getFillType(oldFill);
|
|
|
|
var newOrOldFillIsColor = fillType === 'COLOR' || oldFillType === 'COLOR';
|
|
|
|
var changedFillType = fillType === oldFillType || fillType === 'UNKNOWN';
|
|
|
|
|
|
|
|
// if fill.offset is defined, normalize the xy value
|
|
|
|
if(fill.offset !== undefined) {
|
2012-11-14 15:48:30 +08:00
|
|
|
fill.offset = type._getXY(fill.offset);
|
2012-05-04 05:20:50 +08:00
|
|
|
}
|
2012-05-27 11:34:36 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/*
|
|
|
|
* merge fill objects if neither the new or old fill
|
|
|
|
* is type is COLOR, and if if the fill type has not changed. Otherwise,
|
|
|
|
* overwrite the fill entirely
|
|
|
|
*/
|
|
|
|
if(!newOrOldFillIsColor && changedFillType) {
|
2012-11-14 15:48:30 +08:00
|
|
|
fill = type._merge(fill, oldFill);
|
2012-05-27 11:34:36 +08:00
|
|
|
}
|
2012-07-22 12:09:02 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
this.setAttr('fill', fill);
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* set width and height
|
|
|
|
* @name setSize
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
setSize: function() {
|
2012-11-14 15:48:30 +08:00
|
|
|
var size = Kinetic.Type._getSize(Array.prototype.slice.call(arguments));
|
2012-11-14 14:54:08 +08:00
|
|
|
this.setWidth(size.width);
|
|
|
|
this.setHeight(size.height);
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* return shape size
|
|
|
|
* @name getSize
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
getSize: function() {
|
|
|
|
return {
|
|
|
|
width: this.getWidth(),
|
|
|
|
height: this.getHeight()
|
|
|
|
};
|
|
|
|
},
|
|
|
|
_get: function(selector) {
|
|
|
|
return this.nodeType === selector || this.shapeType === selector ? [this] : [];
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* determines if point is in the shape
|
|
|
|
* @param {Object|Array} point point can be an object containing
|
|
|
|
* an x and y property, or it can be an array with two elements
|
|
|
|
* in which the first element is the x component and the second
|
|
|
|
* element is the y component
|
|
|
|
*/
|
|
|
|
intersects: function() {
|
2012-11-14 15:48:30 +08:00
|
|
|
var pos = Kinetic.Type._getXY(Array.prototype.slice.call(arguments));
|
2012-11-14 14:54:08 +08:00
|
|
|
var stage = this.getStage();
|
2012-11-19 11:50:50 +08:00
|
|
|
var hitCanvas = stage.hitCanvas;
|
|
|
|
hitCanvas.clear();
|
|
|
|
this.drawBuffer(hitCanvas);
|
|
|
|
var p = hitCanvas.context.getImageData(Math.round(pos.x), Math.round(pos.y), 1, 1).data;
|
2012-11-14 14:54:08 +08:00
|
|
|
return p[3] > 0;
|
|
|
|
},
|
|
|
|
remove: function() {
|
|
|
|
Kinetic.Node.prototype.remove.call(this);
|
|
|
|
delete Kinetic.Global.shapes[this.colorKey];
|
|
|
|
},
|
2012-11-19 11:50:50 +08:00
|
|
|
drawBuffer: function(canvas) {
|
|
|
|
var attrs = this.attrs, drawFunc = attrs.drawFunc, context = canvas.getContext();
|
2012-11-14 14:54:08 +08:00
|
|
|
|
2012-11-19 11:50:50 +08:00
|
|
|
if(drawFunc && this.isVisible()) {
|
|
|
|
var stage = this.getStage(), family = [], parent = this.parent;
|
2012-11-14 14:54:08 +08:00
|
|
|
|
|
|
|
family.unshift(this);
|
|
|
|
while(parent) {
|
|
|
|
family.unshift(parent);
|
|
|
|
parent = parent.parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
context.save();
|
2012-11-24 06:54:32 +08:00
|
|
|
this._applyOpacity(context);
|
|
|
|
this._applyLineJoin(context);
|
|
|
|
this._applyLineCap(context);
|
2012-11-14 14:54:08 +08:00
|
|
|
var len = family.length;
|
|
|
|
for(var n = 0; n < len; n++) {
|
|
|
|
var node = family[n], t = node.getTransform(), m = t.getMatrix();
|
|
|
|
context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
|
|
}
|
|
|
|
|
2012-11-19 11:50:50 +08:00
|
|
|
drawFunc.call(this, context);
|
|
|
|
context.restore();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
drawScene: function() {
|
|
|
|
var attrs = this.attrs, drawFunc = attrs.drawFunc, context = this.getLayer().getCanvas().getContext();
|
|
|
|
|
|
|
|
if(drawFunc && this.isVisible()) {
|
|
|
|
var stage = this.getStage(), family = [], parent = this.parent;
|
|
|
|
|
|
|
|
family.unshift(this);
|
|
|
|
while(parent) {
|
|
|
|
family.unshift(parent);
|
|
|
|
parent = parent.parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
context.save();
|
2012-11-24 06:54:32 +08:00
|
|
|
this._applyOpacity(context);
|
|
|
|
this._applyLineJoin(context);
|
|
|
|
this._applyLineCap(context);
|
2012-11-19 11:50:50 +08:00
|
|
|
var len = family.length;
|
|
|
|
for(var n = 0; n < len; n++) {
|
|
|
|
var node = family[n], t = node.getTransform(), m = t.getMatrix();
|
|
|
|
context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
2012-11-14 14:54:08 +08:00
|
|
|
}
|
2012-11-24 06:54:32 +08:00
|
|
|
|
2012-11-19 11:50:50 +08:00
|
|
|
drawFunc.call(this, context);
|
|
|
|
context.restore();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
drawHit: function() {
|
|
|
|
var attrs = this.attrs, drawFunc = attrs.drawHitFunc || attrs.drawFunc, context = this.getLayer().hitCanvas.getContext();
|
2012-11-19 12:28:55 +08:00
|
|
|
|
2012-11-19 11:50:50 +08:00
|
|
|
if(drawFunc && this.isVisible() && this.isListening()) {
|
|
|
|
var stage = this.getStage(), family = [], parent = this.parent;
|
|
|
|
|
|
|
|
family.unshift(this);
|
|
|
|
while(parent) {
|
|
|
|
family.unshift(parent);
|
|
|
|
parent = parent.parent;
|
|
|
|
}
|
2012-11-14 14:54:08 +08:00
|
|
|
|
2012-11-19 11:50:50 +08:00
|
|
|
context.save();
|
2012-11-24 06:54:32 +08:00
|
|
|
this._applyLineJoin(context);
|
|
|
|
this._applyLineCap(context);
|
2012-11-19 11:50:50 +08:00
|
|
|
var len = family.length;
|
|
|
|
for(var n = 0; n < len; n++) {
|
|
|
|
var node = family[n], t = node.getTransform(), m = t.getMatrix();
|
|
|
|
context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
|
|
}
|
|
|
|
|
|
|
|
drawFunc.call(this, context);
|
2012-11-14 14:54:08 +08:00
|
|
|
context.restore();
|
2012-05-27 11:34:36 +08:00
|
|
|
}
|
2012-11-19 12:28:55 +08:00
|
|
|
},
|
|
|
|
_setDrawFuncs: function() {
|
|
|
|
if(!this.attrs.drawFunc && this.drawFunc) {
|
|
|
|
this.setDrawFunc(this.drawFunc);
|
|
|
|
}
|
|
|
|
if(!this.attrs.drawHitFunc && this.drawHitFunc) {
|
|
|
|
this.setDrawHitFunc(this.drawHitFunc);
|
|
|
|
}
|
2012-05-21 01:47:28 +08:00
|
|
|
}
|
2012-11-14 14:54:08 +08:00
|
|
|
};
|
2012-11-27 12:42:01 +08:00
|
|
|
Kinetic.Global.extend(Kinetic.Shape, Kinetic.Node);
|
2012-05-21 01:47:28 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
// add getters and setters
|
2012-11-27 12:42:01 +08:00
|
|
|
Kinetic.Node.addGettersSetters(Kinetic.Shape, ['stroke', 'lineJoin', 'lineCap', 'strokeWidth', 'drawFunc', 'drawHitFunc', 'cornerRadius']);
|
|
|
|
Kinetic.Node.addGetters(Kinetic.Shape, ['shadow', 'fill']);
|
2012-05-27 11:34:36 +08:00
|
|
|
|
|
|
|
/**
|
2012-11-14 14:54:08 +08:00
|
|
|
* set stroke color
|
|
|
|
* @name setStroke
|
2012-07-09 12:56:52 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-11-14 14:54:08 +08:00
|
|
|
* @param {String} stroke
|
2012-05-27 11:34:36 +08:00
|
|
|
*/
|
2012-11-14 14:54:08 +08:00
|
|
|
|
2012-10-07 06:05:03 +08:00
|
|
|
/**
|
2012-11-14 14:54:08 +08:00
|
|
|
* set line join
|
|
|
|
* @name setLineJoin
|
2012-10-07 06:05:03 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-11-14 14:54:08 +08:00
|
|
|
* @param {String} lineJoin. Can be miter, round, or bevel. The
|
|
|
|
* default is miter
|
2012-10-07 06:05:03 +08:00
|
|
|
*/
|
2012-11-14 14:54:08 +08:00
|
|
|
|
2012-09-25 11:34:23 +08:00
|
|
|
/**
|
2012-11-14 14:54:08 +08:00
|
|
|
* set stroke width
|
|
|
|
* @name setStrokeWidth
|
2012-09-25 11:34:23 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-11-14 14:54:08 +08:00
|
|
|
* @param {Number} strokeWidth
|
2012-09-25 11:34:23 +08:00
|
|
|
*/
|
2012-11-14 14:54:08 +08:00
|
|
|
|
2012-09-25 11:34:23 +08:00
|
|
|
/**
|
2012-11-14 14:54:08 +08:00
|
|
|
* set draw function
|
|
|
|
* @name setDrawFunc
|
2012-09-25 11:34:23 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-11-14 14:54:08 +08:00
|
|
|
* @param {Function} drawFunc drawing function
|
2012-09-25 11:34:23 +08:00
|
|
|
*/
|
2012-09-26 06:57:57 +08:00
|
|
|
|
2012-11-15 13:55:16 +08:00
|
|
|
/**
|
2012-11-19 11:50:50 +08:00
|
|
|
* set draw hit function used for hit detection
|
|
|
|
* @name setDrawHitFunc
|
2012-11-15 13:55:16 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-11-19 11:50:50 +08:00
|
|
|
* @param {Function} drawHitFunc drawing function used for hit detection
|
2012-11-15 13:55:16 +08:00
|
|
|
*/
|
|
|
|
|
2012-09-25 11:34:23 +08:00
|
|
|
/**
|
2012-11-14 14:54:08 +08:00
|
|
|
* set corner radius
|
|
|
|
* @name setCornerRadius
|
2012-09-25 11:34:23 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-11-14 14:54:08 +08:00
|
|
|
* @param {Number} corner radius
|
2012-09-25 11:34:23 +08:00
|
|
|
*/
|
2012-11-14 14:54:08 +08:00
|
|
|
|
2012-09-25 11:34:23 +08:00
|
|
|
/**
|
2012-11-14 14:54:08 +08:00
|
|
|
* set line cap. Can be butt, round, or square
|
|
|
|
* @name setLineCap
|
2012-09-25 11:34:23 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-11-14 14:54:08 +08:00
|
|
|
* @param {String} lineCap
|
2012-09-25 11:34:23 +08:00
|
|
|
*/
|
2012-11-14 14:54:08 +08:00
|
|
|
|
2012-06-02 15:39:17 +08:00
|
|
|
/**
|
2012-11-14 14:54:08 +08:00
|
|
|
* get stroke color
|
|
|
|
* @name getStroke
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-06-02 15:39:17 +08:00
|
|
|
*/
|
2012-05-27 11:34:36 +08:00
|
|
|
|
2012-04-16 00:18:30 +08:00
|
|
|
/**
|
2012-11-14 14:54:08 +08:00
|
|
|
* get line join
|
|
|
|
* @name getLineJoin
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-04-16 00:18:30 +08:00
|
|
|
*/
|
2012-03-24 14:39:54 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
|
|
|
* get stroke width
|
|
|
|
* @name getStrokeWidth
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
2012-07-22 12:09:02 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
|
|
|
* get corner radius
|
|
|
|
* @name getCornerRadius
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
2012-11-13 11:59:19 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
|
|
|
* get draw function
|
|
|
|
* @name getDrawFunc
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
2012-11-13 11:59:19 +08:00
|
|
|
|
2012-11-15 13:55:16 +08:00
|
|
|
/**
|
2012-11-19 11:50:50 +08:00
|
|
|
* get draw hit function
|
|
|
|
* @name getDrawHitFunc
|
2012-11-15 13:55:16 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
|
|
|
* get shadow object
|
|
|
|
* @name getShadow
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
2012-04-15 07:27:00 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
|
|
|
* get fill
|
|
|
|
* @name getFill
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
2012-08-11 13:33:22 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
|
|
|
* get line cap
|
|
|
|
* @name getLineCap
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
})();
|