2012-11-27 12:42:01 +08:00
|
|
|
(function() {
|
2013-08-10 15:58:53 +08:00
|
|
|
var HAS_SHADOW = 'hasShadow';
|
|
|
|
|
2013-09-01 17:03:24 +08:00
|
|
|
function _fillFunc(context) {
|
|
|
|
context.fill();
|
2013-01-25 14:44:00 +08:00
|
|
|
}
|
2013-09-01 17:03:24 +08:00
|
|
|
function _strokeFunc(context) {
|
|
|
|
context.stroke();
|
2013-01-25 14:44:00 +08:00
|
|
|
}
|
2013-09-01 17:03:24 +08:00
|
|
|
function _fillFuncHit(context) {
|
|
|
|
context.fill();
|
2013-02-12 14:55:24 +08:00
|
|
|
}
|
2013-09-01 17:03:24 +08:00
|
|
|
function _strokeFuncHit(context) {
|
|
|
|
context.stroke();
|
2013-02-12 14:55:24 +08:00
|
|
|
}
|
2012-04-29 12:12:01 +08:00
|
|
|
|
2013-08-11 04:04:02 +08:00
|
|
|
function _clearHasShadowCache() {
|
|
|
|
this._clearCache(HAS_SHADOW);
|
|
|
|
}
|
|
|
|
|
2013-05-08 14:51:02 +08:00
|
|
|
Kinetic.Util.addMethods(Kinetic.Shape, {
|
2013-07-23 12:41:41 +08:00
|
|
|
__init: function(config) {
|
2012-11-14 14:54:08 +08:00
|
|
|
this.nodeType = 'Shape';
|
2013-01-25 14:44:00 +08:00
|
|
|
this._fillFunc = _fillFunc;
|
|
|
|
this._strokeFunc = _strokeFunc;
|
2013-02-12 14:55:24 +08:00
|
|
|
this._fillFuncHit = _fillFuncHit;
|
|
|
|
this._strokeFuncHit = _strokeFuncHit;
|
2012-05-27 11:34:36 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
// set colorKey
|
2013-09-09 13:02:04 +08:00
|
|
|
var shapes = Kinetic.shapes;
|
2012-11-14 14:54:08 +08:00
|
|
|
var key;
|
2012-11-15 13:55:16 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
while(true) {
|
2013-05-08 14:51:02 +08:00
|
|
|
key = Kinetic.Util.getRandomColor();
|
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);
|
2013-07-23 12:49:30 +08:00
|
|
|
|
2014-03-03 19:24:00 +08:00
|
|
|
this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChange.kinetic', _clearHasShadowCache);
|
2012-11-14 14:54:08 +08:00
|
|
|
},
|
2013-06-07 13:45:31 +08:00
|
|
|
hasChildren: function() {
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
getChildren: function() {
|
|
|
|
return [];
|
|
|
|
},
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
|
|
|
* get canvas context tied to the layer
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Kinetic.Context}
|
2012-11-14 14:54:08 +08:00
|
|
|
*/
|
|
|
|
getContext: function() {
|
|
|
|
return this.getLayer().getContext();
|
|
|
|
},
|
|
|
|
/**
|
2012-12-17 04:56:30 +08:00
|
|
|
* get canvas renderer tied to the layer. Note that this returns a canvas renderer, not a canvas element
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Kinetic.Canvas}
|
2012-11-14 14:54:08 +08:00
|
|
|
*/
|
|
|
|
getCanvas: function() {
|
|
|
|
return this.getLayer().getCanvas();
|
|
|
|
},
|
2012-12-31 16:45:38 +08:00
|
|
|
/**
|
|
|
|
* returns whether or not a shadow will be rendered
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Boolean}
|
2012-12-31 16:45:38 +08:00
|
|
|
*/
|
|
|
|
hasShadow: function() {
|
2014-02-27 08:49:18 +08:00
|
|
|
return this._getCache(HAS_SHADOW, this._hasShadow);
|
2013-08-10 15:58:53 +08:00
|
|
|
},
|
|
|
|
_hasShadow: function() {
|
2013-09-30 04:01:13 +08:00
|
|
|
return this.getShadowEnabled() && (this.getShadowOpacity() !== 0 && !!(this.getShadowColor() || this.getShadowBlur() || this.getShadowOffsetX() || this.getShadowOffsetY()));
|
2012-12-31 16:45:38 +08:00
|
|
|
},
|
2013-01-24 15:08:01 +08:00
|
|
|
/**
|
2013-09-30 04:01:13 +08:00
|
|
|
* returns whether or not the shape will be filled
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Boolean}
|
2013-01-24 15:08:01 +08:00
|
|
|
*/
|
|
|
|
hasFill: function() {
|
2013-05-06 14:07:55 +08:00
|
|
|
return !!(this.getFill() || this.getFillPatternImage() || this.getFillLinearGradientColorStops() || this.getFillRadialGradientColorStops());
|
2013-01-24 15:08:01 +08:00
|
|
|
},
|
2013-09-30 04:01:13 +08:00
|
|
|
/**
|
|
|
|
* returns whether or not the shape will be stroked
|
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Boolean}
|
2013-09-30 04:01:13 +08:00
|
|
|
*/
|
|
|
|
hasStroke: function() {
|
2014-01-09 16:29:38 +08:00
|
|
|
return !!(this.stroke() || this.strokeRed() || this.strokeGreen() || this.strokeBlue());
|
2013-09-30 04:01:13 +08:00
|
|
|
},
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
2013-04-12 14:51:21 +08:00
|
|
|
* determines if point is in the shape, regardless if other shapes are on top of it. Note: because
|
2013-05-18 11:56:24 +08:00
|
|
|
* this method clears a temporary canvas and then redraws the shape, it performs very poorly if executed many times
|
|
|
|
* consecutively. Please use the {@link Kinetic.Stage#getIntersection} method if at all possible
|
|
|
|
* because it performs much better
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 13:25:20 +08:00
|
|
|
* @param {Object} point
|
|
|
|
* @param {Number} point.x
|
|
|
|
* @param {Number} point.y
|
|
|
|
* @returns {Boolean}
|
2012-11-14 14:54:08 +08:00
|
|
|
*/
|
2014-08-19 19:27:46 +08:00
|
|
|
intersects: function(point) {
|
2013-12-03 13:25:20 +08:00
|
|
|
var stage = this.getStage(),
|
2013-09-27 13:10:37 +08:00
|
|
|
bufferHitCanvas = stage.bufferHitCanvas,
|
|
|
|
p;
|
|
|
|
|
|
|
|
bufferHitCanvas.getContext().clear();
|
|
|
|
this.drawScene(bufferHitCanvas);
|
2014-08-19 19:27:46 +08:00
|
|
|
p = bufferHitCanvas.context.getImageData(Math.round(point.x), Math.round(point.y), 1, 1).data;
|
2012-11-14 14:54:08 +08:00
|
|
|
return p[3] > 0;
|
|
|
|
},
|
2013-09-01 12:49:18 +08:00
|
|
|
// extends Node.prototype.destroy
|
2013-04-12 16:14:31 +08:00
|
|
|
destroy: function() {
|
|
|
|
Kinetic.Node.prototype.destroy.call(this);
|
2013-09-09 13:02:04 +08:00
|
|
|
delete Kinetic.shapes[this.colorKey];
|
2012-11-14 14:54:08 +08:00
|
|
|
},
|
2013-09-30 04:01:13 +08:00
|
|
|
_useBufferCanvas: function() {
|
2014-03-07 18:20:03 +08:00
|
|
|
return (this.hasShadow() || this.getAbsoluteOpacity() !== 1) && this.hasFill() && this.hasStroke() && this.getStage();
|
2013-09-30 04:01:13 +08:00
|
|
|
},
|
2014-03-22 15:13:05 +08:00
|
|
|
drawScene: function(can, top) {
|
2014-03-10 03:41:16 +08:00
|
|
|
var layer = this.getLayer(),
|
|
|
|
canvas = can || layer.getCanvas(),
|
2013-09-26 16:39:50 +08:00
|
|
|
context = canvas.getContext(),
|
2013-12-29 05:25:15 +08:00
|
|
|
cachedCanvas = this._cache.canvas,
|
2014-01-05 15:34:01 +08:00
|
|
|
drawFunc = this.sceneFunc(),
|
2013-12-29 05:25:15 +08:00
|
|
|
hasShadow = this.hasShadow(),
|
|
|
|
stage, bufferCanvas, bufferContext;
|
2013-12-20 15:29:23 +08:00
|
|
|
|
2014-02-27 08:49:18 +08:00
|
|
|
if(this.isVisible()) {
|
2014-01-01 05:04:05 +08:00
|
|
|
if (cachedCanvas) {
|
|
|
|
this._drawCachedSceneCanvas(context);
|
2013-12-20 15:29:23 +08:00
|
|
|
}
|
|
|
|
else if (drawFunc) {
|
2014-01-01 05:04:05 +08:00
|
|
|
context.save();
|
2013-12-29 05:25:15 +08:00
|
|
|
// if buffer canvas is needed
|
|
|
|
if (this._useBufferCanvas()) {
|
|
|
|
stage = this.getStage();
|
|
|
|
bufferCanvas = stage.bufferCanvas;
|
|
|
|
bufferContext = bufferCanvas.getContext();
|
|
|
|
bufferContext.clear();
|
|
|
|
bufferContext.save();
|
|
|
|
bufferContext._applyLineJoin(this);
|
2014-04-27 22:39:51 +08:00
|
|
|
// layer might be undefined if we are using cache before adding to layer
|
|
|
|
if (layer) {
|
|
|
|
layer._applyTransform(this, bufferContext, top);
|
2014-05-11 20:22:30 +08:00
|
|
|
} else {
|
|
|
|
var m = this.getAbsoluteTransform(top).getMatrix();
|
|
|
|
context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
2014-04-27 22:39:51 +08:00
|
|
|
}
|
2013-12-29 05:25:15 +08:00
|
|
|
|
|
|
|
drawFunc.call(this, bufferContext);
|
|
|
|
bufferContext.restore();
|
2013-12-20 15:29:23 +08:00
|
|
|
|
2014-10-02 22:41:51 +08:00
|
|
|
if (hasShadow && !canvas.hitCanvas) {
|
2013-12-29 05:25:15 +08:00
|
|
|
context.save();
|
|
|
|
context._applyShadow(this);
|
2014-02-27 08:49:18 +08:00
|
|
|
context.drawImage(bufferCanvas._canvas, 0, 0);
|
2013-12-29 05:25:15 +08:00
|
|
|
context.restore();
|
|
|
|
}
|
2012-11-19 11:50:50 +08:00
|
|
|
|
2013-12-29 05:25:15 +08:00
|
|
|
context._applyOpacity(this);
|
|
|
|
context.drawImage(bufferCanvas._canvas, 0, 0);
|
|
|
|
}
|
|
|
|
// if buffer canvas is not needed
|
|
|
|
else {
|
|
|
|
context._applyLineJoin(this);
|
2014-04-27 22:39:51 +08:00
|
|
|
// layer might be undefined if we are using cache before adding to layer
|
|
|
|
if (layer) {
|
|
|
|
layer._applyTransform(this, context, top);
|
2014-05-11 20:22:30 +08:00
|
|
|
} else {
|
2014-08-19 19:27:46 +08:00
|
|
|
var o = this.getAbsoluteTransform(top).getMatrix();
|
|
|
|
context.transform(o[0], o[1], o[2], o[3], o[4], o[5]);
|
2014-04-27 22:39:51 +08:00
|
|
|
}
|
2013-12-29 05:25:15 +08:00
|
|
|
|
2014-10-02 22:41:51 +08:00
|
|
|
if (hasShadow && !canvas.hitCanvas) {
|
2013-12-29 05:25:15 +08:00
|
|
|
context.save();
|
|
|
|
context._applyShadow(this);
|
|
|
|
drawFunc.call(this, context);
|
|
|
|
context.restore();
|
2014-02-27 08:49:18 +08:00
|
|
|
}
|
2013-09-26 16:39:50 +08:00
|
|
|
|
2013-12-29 05:25:15 +08:00
|
|
|
context._applyOpacity(this);
|
|
|
|
drawFunc.call(this, context);
|
2014-02-27 08:49:18 +08:00
|
|
|
}
|
|
|
|
context.restore();
|
2013-09-26 16:39:50 +08:00
|
|
|
}
|
2013-12-20 15:29:23 +08:00
|
|
|
}
|
2013-09-30 04:01:13 +08:00
|
|
|
|
2013-12-29 05:25:15 +08:00
|
|
|
return this;
|
2012-11-19 11:50:50 +08:00
|
|
|
},
|
2014-03-22 15:13:05 +08:00
|
|
|
drawHit: function(can, top) {
|
2014-03-10 03:41:16 +08:00
|
|
|
var layer = this.getLayer(),
|
|
|
|
canvas = can || layer.hitCanvas,
|
2013-12-20 15:29:23 +08:00
|
|
|
context = canvas.getContext(),
|
2014-01-05 15:34:01 +08:00
|
|
|
drawFunc = this.hitFunc() || this.sceneFunc(),
|
2013-12-29 05:25:15 +08:00
|
|
|
cachedCanvas = this._cache.canvas,
|
|
|
|
cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
|
2012-11-19 12:28:55 +08:00
|
|
|
|
2014-01-22 06:24:36 +08:00
|
|
|
if(this.shouldDrawHit(canvas)) {
|
2014-05-17 13:16:45 +08:00
|
|
|
if (layer) {
|
2014-05-17 21:10:49 +08:00
|
|
|
layer.clearHitCache();
|
2014-05-17 13:16:45 +08:00
|
|
|
}
|
2013-12-20 15:29:23 +08:00
|
|
|
if (cachedHitCanvas) {
|
2014-01-05 17:10:56 +08:00
|
|
|
this._drawCachedHitCanvas(context);
|
2013-12-20 15:29:23 +08:00
|
|
|
}
|
|
|
|
else if (drawFunc) {
|
2014-01-01 05:04:05 +08:00
|
|
|
context.save();
|
2013-12-20 15:29:23 +08:00
|
|
|
context._applyLineJoin(this);
|
2014-05-04 12:11:50 +08:00
|
|
|
if (layer) {
|
|
|
|
layer._applyTransform(this, context, top);
|
2014-05-11 20:22:30 +08:00
|
|
|
} else {
|
|
|
|
var m = this.getAbsoluteTransform(top).getMatrix();
|
|
|
|
context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
2014-05-04 12:11:50 +08:00
|
|
|
}
|
2013-12-29 05:25:15 +08:00
|
|
|
|
2014-02-27 08:49:18 +08:00
|
|
|
drawFunc.call(this, context);
|
2014-01-01 05:04:05 +08:00
|
|
|
context.restore();
|
2013-12-20 15:29:23 +08:00
|
|
|
}
|
2014-01-01 05:04:05 +08:00
|
|
|
|
2012-05-27 11:34:36 +08:00
|
|
|
}
|
2013-12-20 15:29:23 +08:00
|
|
|
|
2013-06-07 13:45:31 +08:00
|
|
|
return this;
|
2014-01-05 17:10:56 +08:00
|
|
|
},
|
|
|
|
/**
|
|
|
|
* draw hit graph using the cached scene canvas
|
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-05 17:24:23 +08:00
|
|
|
* @param {Integer} alphaThreshold alpha channel threshold that determines whether or not
|
|
|
|
* a pixel should be drawn onto the hit graph. Must be a value between 0 and 255.
|
|
|
|
* The default is 0
|
2014-01-05 17:10:56 +08:00
|
|
|
* @returns {Kinetic.Shape}
|
|
|
|
* @example
|
|
|
|
* shape.cache();
|
|
|
|
* shape.drawHitFromCache();
|
|
|
|
*/
|
2014-01-05 17:24:23 +08:00
|
|
|
drawHitFromCache: function(alphaThreshold) {
|
|
|
|
var threshold = alphaThreshold || 0,
|
|
|
|
cachedCanvas = this._cache.canvas,
|
|
|
|
sceneCanvas = this._getCachedSceneCanvas(),
|
2014-01-05 17:10:56 +08:00
|
|
|
sceneContext = sceneCanvas.getContext(),
|
|
|
|
hitCanvas = cachedCanvas.hit,
|
|
|
|
hitContext = hitCanvas.getContext(),
|
|
|
|
width = sceneCanvas.getWidth(),
|
|
|
|
height = sceneCanvas.getHeight(),
|
|
|
|
sceneImageData, sceneData, hitImageData, hitData, len, rgbColorKey, i, alpha;
|
|
|
|
|
|
|
|
hitContext.clear();
|
|
|
|
|
2014-01-08 15:56:49 +08:00
|
|
|
try {
|
2014-01-05 17:10:56 +08:00
|
|
|
sceneImageData = sceneContext.getImageData(0, 0, width, height);
|
|
|
|
sceneData = sceneImageData.data;
|
|
|
|
hitImageData = hitContext.getImageData(0, 0, width, height);
|
|
|
|
hitData = hitImageData.data;
|
|
|
|
len = sceneData.length;
|
|
|
|
rgbColorKey = Kinetic.Util._hexToRgb(this.colorKey);
|
|
|
|
|
|
|
|
// replace non transparent pixels with color key
|
|
|
|
for(i = 0; i < len; i += 4) {
|
|
|
|
alpha = sceneData[i + 3];
|
2014-01-05 17:24:23 +08:00
|
|
|
if (alpha > threshold) {
|
2014-01-05 17:10:56 +08:00
|
|
|
hitData[i] = rgbColorKey.r;
|
|
|
|
hitData[i + 1] = rgbColorKey.g;
|
|
|
|
hitData[i + 2] = rgbColorKey.b;
|
2014-01-05 17:24:23 +08:00
|
|
|
hitData[i + 3] = 255;
|
2014-01-05 17:10:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hitContext.putImageData(hitImageData, 0, 0);
|
2014-01-08 15:56:49 +08:00
|
|
|
}
|
|
|
|
catch(e) {
|
|
|
|
Kinetic.Util.warn('Unable to draw hit graph from cached scene canvas. ' + e.message);
|
|
|
|
}
|
2014-01-05 17:10:56 +08:00
|
|
|
|
|
|
|
return this;
|
2014-08-19 19:27:46 +08:00
|
|
|
}
|
2013-05-08 14:17:57 +08:00
|
|
|
});
|
2013-05-08 14:51:02 +08:00
|
|
|
Kinetic.Util.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
|
2014-01-09 16:29:38 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'stroke');
|
2013-01-02 15:54:02 +08:00
|
|
|
|
2012-05-27 11:34:36 +08:00
|
|
|
/**
|
2014-01-10 14:37:27 +08:00
|
|
|
* get/set stroke color
|
|
|
|
* @name stroke
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-08 01:19:54 +08:00
|
|
|
* @param {String} color
|
2014-01-10 14:37:27 +08:00
|
|
|
* @returns {String}
|
2013-05-19 01:40:05 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get stroke color
|
|
|
|
* var stroke = shape.stroke();
|
2014-01-10 14:37:27 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set stroke color with color string
|
|
|
|
* shape.stroke('green');
|
2014-01-10 14:37:27 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set stroke color with hex
|
|
|
|
* shape.stroke('#00ff00');
|
2014-01-10 14:37:27 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set stroke color with rgb
|
|
|
|
* shape.stroke('rgb(0,255,0)');
|
2014-01-10 14:37:27 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set stroke color with rgba and make it 50% opaque
|
2014-01-10 14:37:27 +08:00
|
|
|
* shape.stroke('rgba(0,255,0,0.5');
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'strokeRed', 0, Kinetic.Validators.RGBComponent);
|
2012-11-14 14:54:08 +08:00
|
|
|
|
2014-01-10 14:37:27 +08:00
|
|
|
/**
|
|
|
|
* get/set stroke red component
|
|
|
|
* @name strokeRed
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:37:27 +08:00
|
|
|
* @param {Integer} red
|
|
|
|
* @returns {Integer}
|
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get stroke red component
|
|
|
|
* var strokeRed = shape.strokeRed();
|
2014-01-10 14:37:27 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set stroke red component
|
2014-01-10 14:37:27 +08:00
|
|
|
* shape.strokeRed(0);
|
2013-05-03 01:22:21 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'strokeGreen', 0, Kinetic.Validators.RGBComponent);
|
2013-05-08 01:19:54 +08:00
|
|
|
|
2014-01-10 14:37:27 +08:00
|
|
|
/**
|
|
|
|
* get/set stroke green component
|
|
|
|
* @name strokeGreen
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:37:27 +08:00
|
|
|
* @param {Integer} green
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Integer}
|
2014-01-10 14:37:27 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get stroke green component
|
|
|
|
* var strokeGreen = shape.strokeGreen();
|
2014-01-10 14:37:27 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set stroke green component
|
2014-01-10 14:37:27 +08:00
|
|
|
* shape.strokeGreen(255);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'strokeBlue', 0, Kinetic.Validators.RGBComponent);
|
2013-05-08 01:19:54 +08:00
|
|
|
|
2014-01-10 14:37:27 +08:00
|
|
|
/**
|
|
|
|
* get/set stroke blue component
|
|
|
|
* @name strokeBlue
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:37:27 +08:00
|
|
|
* @param {Integer} blue
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Integer}
|
2014-01-10 14:37:27 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get stroke blue component
|
|
|
|
* var strokeBlue = shape.strokeBlue();
|
2014-01-10 14:37:27 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set stroke blue component
|
2014-01-10 14:37:27 +08:00
|
|
|
* shape.strokeBlue(0);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'strokeAlpha', 1, Kinetic.Validators.alphaComponent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get/set stroke alpha component. Alpha is a real number between 0 and 1. The default
|
|
|
|
* is 1.
|
|
|
|
* @name strokeAlpha
|
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
|
|
|
* @param {Number} alpha
|
|
|
|
* @returns {Number}
|
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get stroke alpha component
|
|
|
|
* var strokeAlpha = shape.strokeAlpha();
|
2014-01-21 03:26:01 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set stroke alpha component
|
2014-01-21 03:26:01 +08:00
|
|
|
* shape.strokeAlpha(0.5);
|
|
|
|
*/
|
|
|
|
|
2014-01-09 16:29:38 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'strokeWidth', 2);
|
|
|
|
|
|
|
|
/**
|
2014-01-10 14:37:27 +08:00
|
|
|
* get/set stroke width
|
|
|
|
* @name strokeWidth
|
2014-01-09 16:29:38 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
|
|
|
* @param {Number} strokeWidth
|
|
|
|
* @returns {Number}
|
2014-01-10 14:37:27 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get stroke width
|
|
|
|
* var strokeWidth = shape.strokeWidth();
|
2014-01-10 14:37:27 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set stroke width
|
2014-01-10 14:37:27 +08:00
|
|
|
* shape.strokeWidth();
|
2014-01-09 16:29:38 +08:00
|
|
|
*/
|
|
|
|
|
2013-08-11 12:11:34 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'lineJoin');
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2012-10-07 06:05:03 +08:00
|
|
|
/**
|
2014-01-10 14:37:27 +08:00
|
|
|
* get/set line join. Can be miter, round, or bevel. The
|
2012-11-14 14:54:08 +08:00
|
|
|
* default is miter
|
2014-01-10 14:37:27 +08:00
|
|
|
* @name lineJoin
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:37:27 +08:00
|
|
|
* @param {String} lineJoin
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {String}
|
2014-01-10 14:37:27 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get line join
|
|
|
|
* var lineJoin = shape.lineJoin();
|
2014-01-10 14:37:27 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set line join
|
2014-01-10 14:37:27 +08:00
|
|
|
* shape.lineJoin('round');
|
2013-05-03 01:22:21 +08:00
|
|
|
*/
|
|
|
|
|
2013-08-11 12:11:34 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'lineCap');
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
/**
|
2014-01-10 14:37:27 +08:00
|
|
|
* get/set line cap. Can be butt, round, or square
|
|
|
|
* @name lineCap
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-01-03 13:35:51 +08:00
|
|
|
* @param {String} lineCap
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {String}
|
2014-01-10 14:37:27 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get line cap
|
|
|
|
* var lineCap = shape.lineCap();
|
2014-01-10 14:37:27 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set line cap
|
2014-01-10 14:37:27 +08:00
|
|
|
* shape.lineCap('round');
|
2013-05-03 01:22:21 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-05 15:34:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'sceneFunc');
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2012-09-25 11:34:23 +08:00
|
|
|
/**
|
2014-01-10 14:37:27 +08:00
|
|
|
* get/set scene draw function
|
|
|
|
* @name sceneFunc
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2012-11-14 14:54:08 +08:00
|
|
|
* @param {Function} drawFunc drawing function
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Function}
|
2014-01-10 14:37:27 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get scene draw function
|
|
|
|
* var sceneFunc = shape.sceneFunc();
|
|
|
|
*
|
|
|
|
* // set scene draw function
|
|
|
|
* shape.sceneFunc(function(context) {
|
|
|
|
* context.beginPath();
|
|
|
|
* context.rect(0, 0, this.width(), this.height());
|
|
|
|
* context.closePath();
|
|
|
|
* context.fillStrokeShape(this);
|
2014-01-10 14:37:27 +08:00
|
|
|
* });
|
2013-05-03 01:22:21 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-05 15:34:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'hitFunc');
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2012-11-15 13:55:16 +08:00
|
|
|
/**
|
2014-01-10 14:37:27 +08:00
|
|
|
* get/set hit draw function
|
|
|
|
* @name hitFunc
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:37:27 +08:00
|
|
|
* @param {Function} drawFunc drawing function
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Function}
|
2014-01-10 14:37:27 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get hit draw function
|
|
|
|
* var hitFunc = shape.hitFunc();
|
|
|
|
*
|
|
|
|
* // set hit draw function
|
|
|
|
* shape.hitFunc(function(context) {
|
|
|
|
* context.beginPath();
|
|
|
|
* context.rect(0, 0, this.width(), this.height());
|
|
|
|
* context.closePath();
|
|
|
|
* context.fillStrokeShape(this);
|
2014-01-10 14:37:27 +08:00
|
|
|
* });
|
2013-05-03 01:22:21 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-10 14:37:27 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'dash');
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2012-12-09 02:21:52 +08:00
|
|
|
/**
|
2014-01-10 14:37:27 +08:00
|
|
|
* get/set dash array for stroke.
|
|
|
|
* @name dash
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:37:27 +08:00
|
|
|
* @param {Array} dash
|
|
|
|
* @returns {Array}
|
2013-12-13 13:41:41 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // apply dashed stroke that is 10px long and 5 pixels apart
|
|
|
|
* line.dash([10, 5]);
|
2013-12-13 13:41:41 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // apply dashed stroke that is made up of alternating dashed
|
|
|
|
* // lines that are 10px long and 20px apart, and dots that have
|
|
|
|
* // a radius of 5px and are 20px apart
|
2014-01-10 14:37:27 +08:00
|
|
|
* line.dash([10, 20, 0.001, 20]);
|
2012-12-09 02:21:52 +08:00
|
|
|
*/
|
|
|
|
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2014-01-09 16:29:38 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowColor');
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2012-12-31 16:45:38 +08:00
|
|
|
/**
|
2014-01-10 14:56:56 +08:00
|
|
|
* get/set shadow color
|
|
|
|
* @name shadowColor
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2012-12-31 16:45:38 +08:00
|
|
|
* @param {String} color
|
2014-01-10 14:56:56 +08:00
|
|
|
* @returns {String}
|
2013-05-19 01:40:05 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow color
|
|
|
|
* var shadow = shape.shadowColor();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow color with color string
|
|
|
|
* shape.shadowColor('green');
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow color with hex
|
|
|
|
* shape.shadowColor('#00ff00');
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow color with rgb
|
|
|
|
* shape.shadowColor('rgb(0,255,0)');
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow color with rgba and make it 50% opaque
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.shadowColor('rgba(0,255,0,0.5');
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowRed', 0, Kinetic.Validators.RGBComponent);
|
2013-05-08 01:19:54 +08:00
|
|
|
|
2014-01-10 14:56:56 +08:00
|
|
|
/**
|
|
|
|
* get/set shadow red component
|
|
|
|
* @name shadowRed
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:56:56 +08:00
|
|
|
* @param {Integer} red
|
|
|
|
* @returns {Integer}
|
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow red component
|
|
|
|
* var shadowRed = shape.shadowRed();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow red component
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.shadowRed(0);
|
2013-05-03 01:22:21 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowGreen', 0, Kinetic.Validators.RGBComponent);
|
2013-05-08 01:19:54 +08:00
|
|
|
|
2014-01-10 14:56:56 +08:00
|
|
|
/**
|
|
|
|
* get/set shadow green component
|
|
|
|
* @name shadowGreen
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:56:56 +08:00
|
|
|
* @param {Integer} green
|
|
|
|
* @returns {Integer}
|
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow green component
|
|
|
|
* var shadowGreen = shape.shadowGreen();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow green component
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.shadowGreen(255);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowBlue', 0, Kinetic.Validators.RGBComponent);
|
2013-05-08 01:19:54 +08:00
|
|
|
|
2014-01-10 14:56:56 +08:00
|
|
|
/**
|
|
|
|
* get/set shadow blue component
|
|
|
|
* @name shadowBlue
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:56:56 +08:00
|
|
|
* @param {Integer} blue
|
|
|
|
* @returns {Integer}
|
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow blue component
|
|
|
|
* var shadowBlue = shape.shadowBlue();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow blue component
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.shadowBlue(0);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowAlpha', 1, Kinetic.Validators.alphaComponent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get/set shadow alpha component. Alpha is a real number between 0 and 1. The default
|
|
|
|
* is 1.
|
|
|
|
* @name shadowAlpha
|
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
|
|
|
* @param {Number} alpha
|
|
|
|
* @returns {Number}
|
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow alpha component
|
|
|
|
* var shadowAlpha = shape.shadowAlpha();
|
2014-01-21 03:26:01 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow alpha component
|
2014-01-21 03:26:01 +08:00
|
|
|
* shape.shadowAlpha(0.5);
|
|
|
|
*/
|
|
|
|
|
2013-08-11 12:11:34 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowBlur');
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2012-12-31 16:45:38 +08:00
|
|
|
/**
|
2014-01-10 14:56:56 +08:00
|
|
|
* get/set shadow blur
|
|
|
|
* @name shadowBlur
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2012-12-31 16:45:38 +08:00
|
|
|
* @param {Number} blur
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-10 14:56:56 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow blur
|
|
|
|
* var shadowBlur = shape.shadowBlur();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow blur
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.shadowBlur(10);
|
2013-05-03 01:22:21 +08:00
|
|
|
*/
|
|
|
|
|
2013-08-11 12:11:34 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowOpacity');
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2012-12-31 16:45:38 +08:00
|
|
|
/**
|
2014-01-10 14:56:56 +08:00
|
|
|
* get/set shadow opacity. must be a value between 0 and 1
|
|
|
|
* @name shadowOpacity
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:56:56 +08:00
|
|
|
* @param {Number} opacity
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-10 14:56:56 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow opacity
|
|
|
|
* var shadowOpacity = shape.shadowOpacity();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow opacity
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.shadowOpacity(0.5);
|
2013-05-03 01:22:21 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape, 'shadowOffset', ['x', 'y']);
|
2013-12-05 00:37:28 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-10 14:56:56 +08:00
|
|
|
* get/set shadow offset
|
|
|
|
* @name shadowOffset
|
2013-12-05 00:37:28 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
|
|
|
* @param {Object} offset
|
|
|
|
* @param {Number} offset.x
|
|
|
|
* @param {Number} offset.y
|
2014-01-10 14:56:56 +08:00
|
|
|
* @returns {Object}
|
2013-12-05 00:37:28 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow offset
|
|
|
|
* var shadowOffset = shape.shadowOffset();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow offset
|
|
|
|
* shape.shadowOffset({
|
|
|
|
* x: 20
|
|
|
|
* y: 10
|
2013-12-05 00:37:28 +08:00
|
|
|
* });
|
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowOffsetX', 0);
|
|
|
|
|
2013-12-05 00:37:28 +08:00
|
|
|
/**
|
2014-01-10 14:56:56 +08:00
|
|
|
* get/set shadow offset x
|
|
|
|
* @name shadowOffsetX
|
2013-12-05 00:37:28 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
|
|
|
* @param {Number} x
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-10 14:56:56 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow offset x
|
|
|
|
* var shadowOffsetX = shape.shadowOffsetX();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow offset x
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.shadowOffsetX(5);
|
2013-12-05 00:37:28 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowOffsetY', 0);
|
|
|
|
|
2013-12-05 00:37:28 +08:00
|
|
|
/**
|
2014-01-10 14:56:56 +08:00
|
|
|
* get/set shadow offset y
|
|
|
|
* @name shadowOffsetY
|
2013-12-05 00:37:28 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
|
|
|
* @param {Number} y
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-10 14:56:56 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow offset y
|
|
|
|
* var shadowOffsetY = shape.shadowOffsetY();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set shadow offset y
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.shadowOffsetY(5);
|
2013-12-05 00:37:28 +08:00
|
|
|
*/
|
2013-12-05 01:10:24 +08:00
|
|
|
|
2013-08-11 12:11:34 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternImage');
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2013-01-02 15:54:02 +08:00
|
|
|
/**
|
2014-01-10 14:56:56 +08:00
|
|
|
* get/set fill pattern image
|
|
|
|
* @name fillPatternImage
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-01-03 13:35:51 +08:00
|
|
|
* @param {Image} image object
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Image}
|
2014-01-10 14:56:56 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern image
|
|
|
|
* var fillPatternImage = shape.fillPatternImage();
|
|
|
|
*
|
|
|
|
* // set fill pattern image
|
|
|
|
* var imageObj = new Image();
|
|
|
|
* imageObj.onload = function() {
|
|
|
|
* shape.fillPatternImage(imageObj);
|
|
|
|
* };
|
2014-01-10 14:56:56 +08:00
|
|
|
* imageObj.src = 'path/to/image/jpg';
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 16:29:38 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fill');
|
2013-01-03 13:35:51 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-10 14:56:56 +08:00
|
|
|
* get/set fill color
|
|
|
|
* @name fill
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-03 01:22:21 +08:00
|
|
|
* @param {String} color
|
2014-01-10 14:56:56 +08:00
|
|
|
* @returns {String}
|
2013-05-19 01:40:05 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill color
|
|
|
|
* var fill = shape.fill();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill color with color string
|
|
|
|
* shape.fill('green');
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill color with hex
|
|
|
|
* shape.fill('#00ff00');
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill color with rgb
|
|
|
|
* shape.fill('rgb(0,255,0)');
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill color with rgba and make it 50% opaque
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.fill('rgba(0,255,0,0.5');
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRed', 0, Kinetic.Validators.RGBComponent);
|
2013-05-08 01:19:54 +08:00
|
|
|
|
2014-01-10 14:56:56 +08:00
|
|
|
/**
|
|
|
|
* get/set fill red component
|
|
|
|
* @name fillRed
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:56:56 +08:00
|
|
|
* @param {Integer} red
|
|
|
|
* @returns {Integer}
|
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill red component
|
|
|
|
* var fillRed = shape.fillRed();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill red component
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.fillRed(0);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillGreen', 0, Kinetic.Validators.RGBComponent);
|
2013-01-03 13:35:51 +08:00
|
|
|
|
2014-01-10 14:56:56 +08:00
|
|
|
/**
|
|
|
|
* get/set fill green component
|
|
|
|
* @name fillGreen
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:56:56 +08:00
|
|
|
* @param {Integer} green
|
|
|
|
* @returns {Integer}
|
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill green component
|
|
|
|
* var fillGreen = shape.fillGreen();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill green component
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.fillGreen(255);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillBlue', 0, Kinetic.Validators.RGBComponent);
|
2013-05-08 01:19:54 +08:00
|
|
|
|
2014-01-10 14:56:56 +08:00
|
|
|
/**
|
|
|
|
* get/set fill blue component
|
|
|
|
* @name fillBlue
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-10 14:56:56 +08:00
|
|
|
* @param {Integer} blue
|
|
|
|
* @returns {Integer}
|
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill blue component
|
|
|
|
* var fillBlue = shape.fillBlue();
|
2014-01-10 14:56:56 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill blue component
|
2014-01-10 14:56:56 +08:00
|
|
|
* shape.fillBlue(0);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-21 03:26:01 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillAlpha', 1, Kinetic.Validators.alphaComponent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get/set fill alpha component. Alpha is a real number between 0 and 1. The default
|
|
|
|
* is 1.
|
|
|
|
* @name fillAlpha
|
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
|
|
|
* @param {Number} alpha
|
|
|
|
* @returns {Number}
|
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill alpha component
|
|
|
|
* var fillAlpha = shape.fillAlpha();
|
2014-01-21 03:26:01 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill alpha component
|
2014-01-21 03:26:01 +08:00
|
|
|
* shape.fillAlpha(0.5);
|
|
|
|
*/
|
2013-05-08 01:19:54 +08:00
|
|
|
|
2014-01-09 16:29:38 +08:00
|
|
|
|
2013-12-05 00:15:04 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternX', 0);
|
2013-01-03 13:35:51 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-12 12:54:57 +08:00
|
|
|
* get/set fill pattern x
|
|
|
|
* @name fillPatternX
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-03 01:22:21 +08:00
|
|
|
* @param {Number} x
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-12 12:54:57 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern x
|
|
|
|
* var fillPatternX = shape.fillPatternX();
|
2014-01-12 12:54:57 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill pattern x
|
2014-01-12 12:54:57 +08:00
|
|
|
* shape.fillPatternX(20);
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2013-12-05 00:15:04 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternY', 0);
|
2013-01-02 15:54:02 +08:00
|
|
|
|
2013-01-31 01:50:36 +08:00
|
|
|
/**
|
2014-01-12 12:54:57 +08:00
|
|
|
* get/set fill pattern y
|
|
|
|
* @name fillPatternY
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-03 01:22:21 +08:00
|
|
|
* @param {Number} y
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-12 12:54:57 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern y
|
|
|
|
* var fillPatternY = shape.fillPatternY();
|
2014-01-12 12:54:57 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill pattern y
|
2014-01-12 12:54:57 +08:00
|
|
|
* shape.fillPatternY(20);
|
2012-06-02 15:39:17 +08:00
|
|
|
*/
|
2012-05-27 11:34:36 +08:00
|
|
|
|
2013-08-11 12:11:34 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillLinearGradientColorStops');
|
2012-03-24 14:39:54 +08:00
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
/**
|
2014-01-12 12:54:57 +08:00
|
|
|
* get/set fill linear gradient color stops
|
|
|
|
* @name fillLinearGradientColorStops
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-03 01:22:21 +08:00
|
|
|
* @param {Array} colorStops
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Array} colorStops
|
2014-01-12 12:54:57 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill linear gradient color stops
|
|
|
|
* var colorStops = shape.fillLinearGradientColorStops();
|
2014-01-12 12:54:57 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // create a linear gradient that starts with red, changes to blue
|
|
|
|
* // halfway through, and then changes to green
|
2014-01-12 12:54:57 +08:00
|
|
|
* shape.fillLinearGradientColorStops(0, 'red', 0.5, 'blue', 1, 'green');
|
2012-11-14 14:54:08 +08:00
|
|
|
*/
|
2012-07-22 12:09:02 +08:00
|
|
|
|
2013-12-05 02:55:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientStartRadius', 0);
|
2012-11-13 11:59:19 +08:00
|
|
|
|
2012-11-15 13:55:16 +08:00
|
|
|
/**
|
2014-01-12 12:54:57 +08:00
|
|
|
* get/set fill radial gradient start radius
|
|
|
|
* @name fillRadialGradientStartRadius
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-03 01:22:21 +08:00
|
|
|
* @param {Number} radius
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-12 12:54:57 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get radial gradient start radius
|
|
|
|
* var startRadius = shape.fillRadialGradientStartRadius();
|
2014-01-12 12:54:57 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set radial gradient start radius
|
2014-01-12 12:54:57 +08:00
|
|
|
* shape.fillRadialGradientStartRadius(0);
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2013-12-05 02:55:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientEndRadius', 0);
|
2012-12-31 16:45:38 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-12 12:54:57 +08:00
|
|
|
* get/set fill radial gradient end radius
|
|
|
|
* @name fillRadialGradientEndRadius
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-03 01:22:21 +08:00
|
|
|
* @param {Number} radius
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-12 12:54:57 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get radial gradient end radius
|
|
|
|
* var endRadius = shape.fillRadialGradientEndRadius();
|
2014-01-12 12:54:57 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set radial gradient end radius
|
2014-01-12 12:54:57 +08:00
|
|
|
* shape.fillRadialGradientEndRadius(100);
|
2012-12-31 16:45:38 +08:00
|
|
|
*/
|
|
|
|
|
2013-08-11 12:11:34 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientColorStops');
|
2013-01-03 13:35:51 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-12 12:54:57 +08:00
|
|
|
* get/set fill radial gradient color stops
|
|
|
|
* @name fillRadialGradientColorStops
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-03 01:22:21 +08:00
|
|
|
* @param {Number} colorStops
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Array}
|
2014-01-12 12:54:57 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill radial gradient color stops
|
|
|
|
* var colorStops = shape.fillRadialGradientColorStops();
|
2014-01-12 12:54:57 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // create a radial gradient that starts with red, changes to blue
|
|
|
|
* // halfway through, and then changes to green
|
2014-01-12 12:54:57 +08:00
|
|
|
* shape.fillRadialGradientColorStops(0, 'red', 0.5, 'blue', 1, 'green');
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-12 12:54:57 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternRepeat', 'repeat');
|
2013-01-03 13:35:51 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-12 12:54:57 +08:00
|
|
|
* get/set fill pattern repeat. Can be 'repeat', 'repeat-x', 'repeat-y', or 'no-repeat'. The default is 'repeat'
|
|
|
|
* @name fillPatternRepeat
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-12 12:54:57 +08:00
|
|
|
* @param {String} repeat
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {String}
|
2014-01-12 12:54:57 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern repeat
|
|
|
|
* var repeat = shape.fillPatternRepeat();
|
2014-01-12 12:54:57 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // repeat pattern in x direction only
|
|
|
|
* shape.fillPatternRepeat('repeat-x');
|
2014-01-12 12:54:57 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // do not repeat the pattern
|
2014-01-12 12:54:57 +08:00
|
|
|
* shape.fillPatternRepeat('no repeat');
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2013-12-05 00:15:04 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillEnabled', true);
|
2013-01-03 13:35:51 +08:00
|
|
|
|
2013-05-08 01:19:54 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill enabled flag
|
|
|
|
* @name fillEnabled
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-08 01:19:54 +08:00
|
|
|
* @param {Boolean} enabled
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Boolean}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill enabled flag
|
|
|
|
* var fillEnabled = shape.fillEnabled();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // disable fill
|
|
|
|
* shape.fillEnabled(false);
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // enable fill
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillEnabled(true);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2013-12-05 00:15:04 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'strokeEnabled', true);
|
2013-05-08 01:19:54 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set stroke enabled flag
|
|
|
|
* @name strokeEnabled
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-08 01:19:54 +08:00
|
|
|
* @param {Boolean} enabled
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Boolean}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get stroke enabled flag
|
|
|
|
* var strokeEnabled = shape.strokeEnabled();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // disable stroke
|
|
|
|
* shape.strokeEnabled(false);
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // enable stroke
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.strokeEnabled(true);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2013-12-05 00:15:04 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'shadowEnabled', true);
|
2013-05-08 01:19:54 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set shadow enabled flag
|
|
|
|
* @name shadowEnabled
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-08 01:19:54 +08:00
|
|
|
* @param {Boolean} enabled
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Boolean}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get shadow enabled flag
|
|
|
|
* var shadowEnabled = shape.shadowEnabled();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // disable shadow
|
|
|
|
* shape.shadowEnabled(false);
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // enable shadow
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.shadowEnabled(true);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-10 14:37:27 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'dashEnabled', true);
|
2013-05-08 01:19:54 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set dash enabled flag
|
|
|
|
* @name dashEnabled
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-05-08 01:19:54 +08:00
|
|
|
* @param {Boolean} enabled
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Boolean}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get dash enabled flag
|
|
|
|
* var dashEnabled = shape.dashEnabled();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // disable dash
|
|
|
|
* shape.dashEnabled(false);
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // enable dash
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.dashEnabled(true);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2013-12-05 00:15:04 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'strokeScaleEnabled', true);
|
2013-01-03 13:35:51 +08:00
|
|
|
|
2014-01-12 16:23:53 +08:00
|
|
|
/**
|
|
|
|
* get/set strokeScale enabled flag
|
|
|
|
* @name strokeScaleEnabled
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-05 00:15:04 +08:00
|
|
|
* @param {Boolean} enabled
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Boolean}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get stroke scale enabled flag
|
|
|
|
* var strokeScaleEnabled = shape.strokeScaleEnabled();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // disable stroke scale
|
|
|
|
* shape.strokeScaleEnabled(false);
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // enable stroke scale
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.strokeScaleEnabled(true);
|
2013-01-31 01:50:36 +08:00
|
|
|
*/
|
|
|
|
|
2013-12-05 00:15:04 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPriority', 'color');
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2013-12-05 00:15:04 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill priority. can be color, pattern, linear-gradient, or radial-gradient. The default is color.
|
|
|
|
* This is handy if you want to toggle between different fill types.
|
|
|
|
* @name fillPriority
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-12 16:23:53 +08:00
|
|
|
* @param {String} priority
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {String}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill priority
|
|
|
|
* var fillPriority = shape.fillPriority();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill priority
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillPriority('linear-gradient');
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape, 'fillPatternOffset', ['x', 'y']);
|
2013-01-03 13:35:51 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill pattern offset
|
|
|
|
* @name fillPatternOffset
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Object} offset
|
|
|
|
* @param {Number} offset.x
|
|
|
|
* @param {Number} offset.y
|
2014-01-12 16:23:53 +08:00
|
|
|
* @returns {Object}
|
2013-05-19 01:40:05 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern offset
|
|
|
|
* var patternOffset = shape.fillPatternOffset();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill pattern offset
|
|
|
|
* shape.fillPatternOffset({
|
|
|
|
* x: 20
|
|
|
|
* y: 10
|
2013-12-03 14:16:58 +08:00
|
|
|
* });
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2013-05-08 01:19:54 +08:00
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternOffsetX', 0);
|
2013-12-03 14:16:58 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill pattern offset x
|
|
|
|
* @name fillPatternOffsetX
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Number} x
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern offset x
|
|
|
|
* var patternOffsetX = shape.fillPatternOffsetX();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill pattern offset x
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillPatternOffsetX(20);
|
2013-05-03 01:22:21 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternOffsetY', 0);
|
2013-12-03 14:16:58 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill pattern offset y
|
|
|
|
* @name fillPatternOffsetY
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Number} y
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern offset y
|
|
|
|
* var patternOffsetY = shape.fillPatternOffsetY();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill pattern offset y
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillPatternOffsetY(10);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape, 'fillPatternScale', ['x', 'y']);
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill pattern scale
|
|
|
|
* @name fillPatternScale
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Object} scale
|
|
|
|
* @param {Number} scale.x
|
|
|
|
* @param {Number} scale.y
|
2014-01-12 16:23:53 +08:00
|
|
|
* @returns {Object}
|
2013-05-19 01:40:05 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern scale
|
|
|
|
* var patternScale = shape.fillPatternScale();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill pattern scale
|
|
|
|
* shape.fillPatternScale({
|
|
|
|
* x: 2
|
|
|
|
* y: 2
|
2013-12-03 14:16:58 +08:00
|
|
|
* });
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
|
2014-01-13 13:48:33 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternScaleX', 1);
|
2013-12-03 14:16:58 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill pattern scale x
|
|
|
|
* @name fillPatternScaleX
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Number} x
|
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern scale x
|
|
|
|
* var patternScaleX = shape.fillPatternScaleX();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill pattern scale x
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillPatternScaleX(2);
|
2013-05-03 01:22:21 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-13 13:48:33 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternScaleY', 1);
|
2013-12-03 14:16:58 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill pattern scale y
|
|
|
|
* @name fillPatternScaleY
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Number} y
|
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern scale y
|
|
|
|
* var patternScaleY = shape.fillPatternScaleY();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill pattern scale y
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillPatternScaleY(2);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape, 'fillLinearGradientStartPoint', ['x', 'y']);
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill linear gradient start point
|
|
|
|
* @name fillLinearGradientStartPoint
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Object} startPoint
|
|
|
|
* @param {Number} startPoint.x
|
|
|
|
* @param {Number} startPoint.y
|
2014-01-12 16:23:53 +08:00
|
|
|
* @returns {Object}
|
2013-05-19 01:40:05 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill linear gradient start point
|
|
|
|
* var startPoint = shape.fillLinearGradientStartPoint();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill linear gradient start point
|
|
|
|
* shape.fillLinearGradientStartPoint({
|
|
|
|
* x: 20
|
|
|
|
* y: 10
|
2013-12-03 14:16:58 +08:00
|
|
|
* });
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillLinearGradientStartPointX', 0);
|
2013-12-03 14:16:58 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill linear gradient start point x
|
|
|
|
* @name fillLinearGradientStartPointX
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Number} x
|
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill linear gradient start point x
|
|
|
|
* var startPointX = shape.fillLinearGradientStartPointX();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill linear gradient start point x
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillLinearGradientStartPointX(20);
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillLinearGradientStartPointY', 0);
|
2013-12-03 14:16:58 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill linear gradient start point y
|
|
|
|
* @name fillLinearGradientStartPointY
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Number} y
|
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill linear gradient start point y
|
|
|
|
* var startPointY = shape.fillLinearGradientStartPointY();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill linear gradient start point y
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillLinearGradientStartPointY(20);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape, 'fillLinearGradientEndPoint', ['x', 'y']);
|
2013-01-03 13:35:51 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill linear gradient end point
|
|
|
|
* @name fillLinearGradientEndPoint
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Object} endPoint
|
2014-01-12 16:23:53 +08:00
|
|
|
* @param {Number} endPoint.x
|
|
|
|
* @param {Number} endPoint.y
|
|
|
|
* @returns {Object}
|
2013-05-19 01:40:05 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill linear gradient end point
|
|
|
|
* var endPoint = shape.fillLinearGradientEndPoint();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill linear gradient end point
|
|
|
|
* shape.fillLinearGradientEndPoint({
|
|
|
|
* x: 20
|
|
|
|
* y: 10
|
2013-12-03 14:16:58 +08:00
|
|
|
* });
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillLinearGradientEndPointX', 0);
|
2013-12-03 14:16:58 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill linear gradient end point x
|
|
|
|
* @name fillLinearGradientEndPointX
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Number} x
|
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill linear gradient end point x
|
|
|
|
* var endPointX = shape.fillLinearGradientEndPointX();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill linear gradient end point x
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillLinearGradientEndPointX(20);
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillLinearGradientEndPointY', 0);
|
2013-12-03 14:16:58 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill linear gradient end point y
|
|
|
|
* @name fillLinearGradientEndPointY
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-03 14:16:58 +08:00
|
|
|
* @param {Number} y
|
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill linear gradient end point y
|
|
|
|
* var endPointY = shape.fillLinearGradientEndPointY();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill linear gradient end point y
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillLinearGradientEndPointY(20);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape, 'fillRadialGradientStartPoint', ['x', 'y']);
|
2013-01-03 13:35:51 +08:00
|
|
|
|
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill radial gradient start point
|
|
|
|
* @name fillRadialGradientStartPoint
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-04 14:01:22 +08:00
|
|
|
* @param {Object} startPoint
|
|
|
|
* @param {Number} startPoint.x
|
|
|
|
* @param {Number} startPoint.y
|
2014-01-12 16:23:53 +08:00
|
|
|
* @returns {Object}
|
2013-05-19 01:40:05 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill radial gradient start point
|
|
|
|
* var startPoint = shape.fillRadialGradientStartPoint();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill radial gradient start point
|
|
|
|
* shape.fillRadialGradientStartPoint({
|
|
|
|
* x: 20
|
|
|
|
* y: 10
|
2013-12-04 14:01:22 +08:00
|
|
|
* });
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientStartPointX', 0);
|
2013-12-04 14:01:22 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill radial gradient start point x
|
|
|
|
* @name fillRadialGradientStartPointX
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-04 14:01:22 +08:00
|
|
|
* @param {Number} x
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill radial gradient start point x
|
|
|
|
* var startPointX = shape.fillRadialGradientStartPointX();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill radial gradient start point x
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillRadialGradientStartPointX(20);
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientStartPointY', 0);
|
2013-12-04 14:01:22 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill radial gradient start point y
|
|
|
|
* @name fillRadialGradientStartPointY
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-04 14:01:22 +08:00
|
|
|
* @param {Number} y
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill radial gradient start point y
|
|
|
|
* var startPointY = shape.fillRadialGradientStartPointY();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill radial gradient start point y
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillRadialGradientStartPointY(20);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addComponentsGetterSetter(Kinetic.Shape, 'fillRadialGradientEndPoint', ['x', 'y']);
|
2013-05-03 01:22:21 +08:00
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill radial gradient end point
|
|
|
|
* @name fillRadialGradientEndPoint
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-12-04 14:01:22 +08:00
|
|
|
* @param {Object} endPoint
|
|
|
|
* @param {Number} endPoint.x
|
|
|
|
* @param {Number} endPoint.y
|
2014-01-12 16:23:53 +08:00
|
|
|
* @returns {Object}
|
2013-05-19 01:40:05 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill radial gradient end point
|
|
|
|
* var endPoint = shape.fillRadialGradientEndPoint();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill radial gradient end point
|
|
|
|
* shape.fillRadialGradientEndPoint({
|
|
|
|
* x: 20
|
|
|
|
* y: 10
|
2013-12-04 14:01:22 +08:00
|
|
|
* });
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientEndPointX', 0);
|
2013-12-04 14:01:22 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill radial gradient end point x
|
|
|
|
* @name fillRadialGradientEndPointX
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2014-01-12 16:23:53 +08:00
|
|
|
* @param {Number} x
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill radial gradient end point x
|
|
|
|
* var endPointX = shape.fillRadialGradientEndPointX();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill radial gradient end point x
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillRadialGradientEndPointX(20);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-09 15:13:50 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientEndPointY', 0);
|
2013-12-04 14:01:22 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill radial gradient end point y
|
|
|
|
* @name fillRadialGradientEndPointY
|
2013-12-04 14:01:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
|
|
|
* @param {Number} y
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Number}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill radial gradient end point y
|
|
|
|
* var endPointY = shape.fillRadialGradientEndPointY();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill radial gradient end point y
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillRadialGradientEndPointY(20);
|
2013-05-08 01:19:54 +08:00
|
|
|
*/
|
|
|
|
|
2014-01-07 13:37:46 +08:00
|
|
|
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternRotation', 0);
|
2013-01-03 13:35:51 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
2014-01-12 16:23:53 +08:00
|
|
|
* get/set fill pattern rotation in degrees
|
|
|
|
* @name fillPatternRotation
|
2013-05-16 00:27:22 +08:00
|
|
|
* @method
|
|
|
|
* @memberof Kinetic.Shape.prototype
|
2013-01-03 13:35:51 +08:00
|
|
|
* @param {Number} rotation
|
2013-12-13 13:41:41 +08:00
|
|
|
* @returns {Kinetic.Shape}
|
2014-01-12 16:23:53 +08:00
|
|
|
* @example
|
2014-04-04 11:17:09 +08:00
|
|
|
* // get fill pattern rotation
|
|
|
|
* var patternRotation = shape.fillPatternRotation();
|
2014-01-12 16:23:53 +08:00
|
|
|
*
|
2014-04-04 11:17:09 +08:00
|
|
|
* // set fill pattern rotation
|
2014-01-12 16:23:53 +08:00
|
|
|
* shape.fillPatternRotation(20);
|
2012-11-14 14:54:08 +08:00
|
|
|
*/
|
2012-08-11 13:33:22 +08:00
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
|
2014-01-11 14:58:55 +08:00
|
|
|
Kinetic.Factory.backCompat(Kinetic.Shape, {
|
|
|
|
dashArray: 'dash',
|
|
|
|
getDashArray: 'getDash',
|
|
|
|
setDashArray: 'getDash',
|
|
|
|
|
|
|
|
drawFunc: 'sceneFunc',
|
|
|
|
getDrawFunc: 'getSceneFunc',
|
|
|
|
setDrawFunc: 'setSceneFunc',
|
|
|
|
|
|
|
|
drawHitFunc: 'hitFunc',
|
|
|
|
getDrawHitFunc: 'getHitFunc',
|
|
|
|
setDrawHitFunc: 'setHitFunc'
|
|
|
|
});
|
2014-01-20 13:35:28 +08:00
|
|
|
|
|
|
|
Kinetic.Collection.mapMethods(Kinetic.Shape);
|
2012-11-14 14:54:08 +08:00
|
|
|
})();
|