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
|
2013-01-03 15:55:56 +08:00
|
|
|
*
|
2013-01-02 15:54:02 +08:00
|
|
|
* @param {String} [config.fill] fill color
|
2013-01-03 15:55:56 +08:00
|
|
|
*
|
2013-01-02 15:54:02 +08:00
|
|
|
* @param {Image} [config.fillPatternImage] fill pattern image
|
|
|
|
* @param {Number} [config.fillPatternX]
|
|
|
|
* @param {Number} [config.fillPatternY]
|
|
|
|
* @param {Array|Object} [config.fillPatternOffset] array with two elements or object with x and y component
|
|
|
|
* @param {Array|Object} [config.fillPatternScale] array with two elements or object with x and y component
|
|
|
|
* @param {Number} [config.fillPatternRotation]
|
|
|
|
* @param {String} [config.fillPatternRepeat] can be 'repeat', 'repeat-x', 'repeat-y', or 'no-repeat'. The default is 'no-repeat'
|
2013-01-03 15:55:56 +08:00
|
|
|
*
|
2013-01-02 15:54:02 +08:00
|
|
|
* @param {Array|Object} [config.fillLinearGradientStartPoint] array with two elements or object with x and y component
|
|
|
|
* @param {Array|Object} [config.fillLinearGradientEndPoint] array with two elements or object with x and y component
|
|
|
|
* @param {Array} [config.fillLinearGradientColorStops] array of color stops
|
2013-01-03 15:55:56 +08:00
|
|
|
*
|
2013-01-02 15:54:02 +08:00
|
|
|
* @param {Array|Object} [config.fillRadialGradientStartPoint] array with two elements or object with x and y component
|
|
|
|
* @param {Array|Object} [config.fillRadialGradientEndPoint] array with two elements or object with x and y component
|
|
|
|
* @param {Number} [config.fillRadialGradientStartRadius]
|
|
|
|
* @param {Number} [config.fillRadialGradientEndRadius]
|
|
|
|
* @param {Array} [config.fillRadialGradientColorStops] array of color stops
|
2013-01-03 15:55:56 +08:00
|
|
|
*
|
2012-12-23 15:08:03 +08:00
|
|
|
* @param {String} [config.stroke] stroke color
|
|
|
|
* @param {Number} [config.strokeWidth] stroke width
|
2013-01-03 14:43:12 +08:00
|
|
|
* @param {String} [config.lineJoin] can be miter, round, or bevel. The default
|
2012-11-14 14:54:08 +08:00
|
|
|
* is miter
|
2013-01-03 14:43:12 +08:00
|
|
|
* @param {String} [config.lineCap] can be butt, round, or sqare. The default
|
|
|
|
* is butt
|
2012-12-31 16:45:38 +08:00
|
|
|
* @param {String} [config.shadowColor]
|
|
|
|
* @param {Number} [config.shadowBlur]
|
|
|
|
* @param {Obect} [config.shadowOffset]
|
|
|
|
* @param {Number} [config.shadowOffset.x]
|
|
|
|
* @param {Number} [config.shadowOffset.y]
|
|
|
|
* @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number
|
2012-11-14 14:54:08 +08:00
|
|
|
* between 0 and 1
|
2012-12-23 15:08:03 +08:00
|
|
|
* @param {Array} [config.dashArray]
|
2013-01-24 15:08:01 +08:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
2013-01-03 15:55:56 +08:00
|
|
|
* @param {Number} [config.x]
|
|
|
|
* @param {Number} [config.y]
|
|
|
|
* @param {Number} [config.width]
|
|
|
|
* @param {Number} [config.height]
|
|
|
|
* @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] offset from center point and rotation point
|
|
|
|
* @param {Number} [config.offset.x]
|
|
|
|
* @param {Number} [config.offset.y]
|
|
|
|
* @param {Boolean} [config.draggable]
|
|
|
|
* @param {Function} [config.dragBoundFunc]
|
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) {
|
2013-01-24 15:08:01 +08:00
|
|
|
this.setDefaultAttrs({
|
|
|
|
fillEnabled: true,
|
|
|
|
strokeEnabled: true,
|
|
|
|
shadowEnabled: true,
|
|
|
|
dashArrayEnabled: true
|
|
|
|
});
|
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
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();
|
|
|
|
},
|
|
|
|
/**
|
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
|
2012-11-14 14:54:08 +08:00
|
|
|
* @name getCanvas
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
getCanvas: function() {
|
|
|
|
return this.getLayer().getCanvas();
|
|
|
|
},
|
2012-12-31 16:45:38 +08:00
|
|
|
/**
|
|
|
|
* returns whether or not a shadow will be rendered
|
|
|
|
* @name hasShadow
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
hasShadow: function() {
|
|
|
|
return !!(this.getShadowColor() || this.getShadowBlur() || this.getShadowOffset());
|
|
|
|
},
|
2013-01-24 15:08:01 +08:00
|
|
|
/**
|
|
|
|
* returns whether or not a fill will be rendered
|
|
|
|
* @name hasFill
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
hasFill: function() {
|
|
|
|
return !!(this.getFill() || this.getFillPatternImage() || this.getFillLinearGradientStartPoint() || this.getFillRadialGradientStartPoint());
|
|
|
|
},
|
2012-11-14 14:54:08 +08:00
|
|
|
_get: function(selector) {
|
|
|
|
return this.nodeType === selector || this.shapeType === selector ? [this] : [];
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* determines if point is in the shape
|
2012-12-17 04:56:30 +08:00
|
|
|
* @name intersects
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Object} point point can be an object containing
|
2012-11-14 14:54:08 +08:00
|
|
|
* 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();
|
2012-12-11 16:08:59 +08:00
|
|
|
this.drawScene(hitCanvas);
|
2012-11-19 11:50:50 +08:00
|
|
|
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;
|
|
|
|
},
|
2013-01-24 15:08:01 +08:00
|
|
|
enableFill: function() {
|
|
|
|
this.setAttr('fillEnabled', true);
|
|
|
|
},
|
|
|
|
disableFill: function() {
|
|
|
|
this.setAttr('fillEnabled', false);
|
|
|
|
},
|
|
|
|
enableStroke: function() {
|
|
|
|
this.setAttr('strokeEnabled', true);
|
|
|
|
},
|
|
|
|
disableStroke: function() {
|
|
|
|
this.setAttr('strokeEnabled', false);
|
|
|
|
},
|
|
|
|
enableShadow: function() {
|
|
|
|
this.setAttr('shadowEnabled', true);
|
|
|
|
},
|
|
|
|
disableShadow: function() {
|
|
|
|
this.setAttr('shadowEnabled', false);
|
|
|
|
},
|
|
|
|
enableDashArray: function() {
|
|
|
|
this.setAttr('dashArrayEnabled', true);
|
|
|
|
},
|
|
|
|
disableDashArray: function() {
|
|
|
|
this.setAttr('dashArrayEnabled', false);
|
|
|
|
},
|
2012-11-14 14:54:08 +08:00
|
|
|
remove: function() {
|
|
|
|
Kinetic.Node.prototype.remove.call(this);
|
|
|
|
delete Kinetic.Global.shapes[this.colorKey];
|
|
|
|
},
|
2012-12-11 16:08:59 +08:00
|
|
|
drawScene: function(canvas) {
|
|
|
|
var attrs = this.attrs, drawFunc = attrs.drawFunc, canvas = canvas || this.getLayer().getCanvas(), context = canvas.getContext();
|
2012-11-19 11:50:50 +08:00
|
|
|
|
|
|
|
if(drawFunc && this.isVisible()) {
|
|
|
|
context.save();
|
2012-12-14 13:53:39 +08:00
|
|
|
canvas._handlePixelRatio();
|
2012-12-10 01:52:33 +08:00
|
|
|
canvas._applyOpacity(this);
|
|
|
|
canvas._applyLineJoin(this);
|
2012-12-31 15:14:23 +08:00
|
|
|
canvas._applyAncestorTransforms(this);
|
2012-11-24 06:54:32 +08:00
|
|
|
|
2012-12-10 01:52:33 +08:00
|
|
|
drawFunc.call(this, canvas);
|
2012-11-19 11:50:50 +08:00
|
|
|
context.restore();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
drawHit: function() {
|
2012-12-10 01:52:33 +08:00
|
|
|
var attrs = this.attrs, drawFunc = attrs.drawHitFunc || attrs.drawFunc, canvas = this.getLayer().hitCanvas, context = canvas.getContext();
|
2012-11-19 12:28:55 +08:00
|
|
|
|
2012-11-19 11:50:50 +08:00
|
|
|
if(drawFunc && this.isVisible() && this.isListening()) {
|
|
|
|
context.save();
|
2012-12-10 01:52:33 +08:00
|
|
|
canvas._applyLineJoin(this);
|
2012-12-31 15:14:23 +08:00
|
|
|
canvas._applyAncestorTransforms(this);
|
2012-11-19 11:50:50 +08:00
|
|
|
|
2012-12-10 01:52:33 +08:00
|
|
|
drawFunc.call(this, canvas);
|
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
|
2013-01-24 15:08:01 +08:00
|
|
|
Kinetic.Node.addGettersSetters(Kinetic.Shape, ['stroke', 'lineJoin', 'lineCap', 'strokeWidth', 'drawFunc', 'drawHitFunc', 'dashArray', 'shadowColor', 'shadowBlur', 'shadowOpacity', 'fillPatternImage', 'fill', 'fillPatternX', 'fillPatternY', 'fillLinearGradientColorStops', 'fillRadialGradientStartRadius', 'fillRadialGradientEndRadius', 'fillRadialGradientColorStops', 'fillPatternRepeat', 'fillEnabled', 'strokeEnabled', 'shadowEnabled', 'dashArrayEnabled']);
|
2013-01-02 15:54:02 +08:00
|
|
|
|
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
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
/**
|
|
|
|
* set line cap. Can be butt, round, or square
|
|
|
|
* @name setLineCap
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {String} lineCap
|
|
|
|
*/
|
|
|
|
|
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-12-09 02:21:52 +08:00
|
|
|
/**
|
|
|
|
* set dash array.
|
|
|
|
* @name setDashArray
|
2013-01-07 01:04:10 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-12-09 02:21:52 +08:00
|
|
|
* @param {Array} dashArray
|
|
|
|
* examples:<br>
|
|
|
|
* [10, 5] dashes are 10px long and 5 pixels apart
|
2012-12-17 04:56:30 +08:00
|
|
|
* [10, 20, 0.001, 20] if using a round lineCap, the line will
|
2012-12-09 02:21:52 +08:00
|
|
|
* be made up of alternating dashed lines that are 10px long
|
2012-12-17 04:56:30 +08:00
|
|
|
* and 20px apart, and dots that have a radius of 5px and are 20px
|
2012-12-09 02:21:52 +08:00
|
|
|
* apart
|
|
|
|
*/
|
|
|
|
|
2012-12-31 16:45:38 +08:00
|
|
|
/**
|
|
|
|
* set shadow color
|
|
|
|
* @name setShadowColor
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {String} color
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set shadow blur
|
|
|
|
* @name setShadowBlur
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number} blur
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set shadow opacity
|
|
|
|
* @name setShadowOpacity
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number} opacity must be a value between 0 and 1
|
|
|
|
*/
|
|
|
|
|
2013-01-02 15:54:02 +08:00
|
|
|
/**
|
2013-01-03 13:35:51 +08:00
|
|
|
* set fill pattern image
|
|
|
|
* @name setFillPatternImage
|
2013-01-02 15:54:02 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2013-01-03 13:35:51 +08:00
|
|
|
* @param {Image} image object
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill color
|
|
|
|
* @name setFill
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {String} color
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill pattern x
|
|
|
|
* @name setFillPatternX
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number} x
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill pattern y
|
|
|
|
* @name setFillPatternY
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number} y
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill linear gradient color stops
|
|
|
|
* @name setFillLinearGradientColorStops
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Array} colorStops
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill radial gradient start radius
|
|
|
|
* @name setFillRadialGradientStartRadius
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number} radius
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill radial gradient end radius
|
|
|
|
* @name setFillRadialGradientEndRadius
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number} radius
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill radial gradient color stops
|
|
|
|
* @name setFillRadialGradientColorStops
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number} colorStops
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill pattern repeat
|
|
|
|
* @name setFillPatternRepeat
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number} repeat can be 'repeat', 'repeat-x', 'repeat-y', or 'no-repeat'. The default is 'no-repeat'
|
2013-01-02 15:54:02 +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
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
/**
|
|
|
|
* get line cap
|
|
|
|
* @name getLineCap
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
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 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
|
|
|
|
*/
|
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
/**
|
|
|
|
* get dash array
|
|
|
|
* @name getDashArray
|
2013-01-07 01:04:10 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2013-01-03 13:35:51 +08:00
|
|
|
*/
|
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
2012-12-31 16:45:38 +08:00
|
|
|
* get shadow color
|
|
|
|
* @name getShadowColor
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get shadow blur
|
|
|
|
* @name getShadowBlur
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get shadow opacity
|
|
|
|
* @name getShadowOpacity
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
/**
|
|
|
|
* get fill pattern image
|
|
|
|
* @name getFillPatternImage
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill color
|
|
|
|
* @name getFill
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill pattern x
|
|
|
|
* @name getFillPatternX
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill pattern y
|
|
|
|
* @name getFillPatternY
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill linear gradient color stops
|
|
|
|
* @name getFillLinearGradientColorStops
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Array} colorStops
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill radial gradient start radius
|
|
|
|
* @name getFillRadialGradientStartRadius
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill radial gradient end radius
|
|
|
|
* @name getFillRadialGradientEndRadius
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill radial gradient color stops
|
|
|
|
* @name getFillRadialGradientColorStops
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill pattern repeat
|
|
|
|
* @name getFillPatternRepeat
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
Kinetic.Node.addPointGettersSetters(Kinetic.Shape, ['fillPatternOffset', 'fillPatternScale', 'fillLinearGradientStartPoint', 'fillLinearGradientEndPoint', 'fillRadialGradientStartPoint', 'fillRadialGradientEndPoint', 'shadowOffset']);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill pattern offset
|
|
|
|
* @name setFillPatternOffset
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number|Array|Object} offset
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill pattern scale
|
|
|
|
* @name setFillPatternScale
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number|Array|Object} scale
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill linear gradient start point
|
|
|
|
* @name setFillLinearGradientStartPoint
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number|Array|Object} startPoint
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill linear gradient end point
|
|
|
|
* @name setFillLinearGradientEndPoint
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number|Array|Object} endPoint
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill radial gradient start point
|
|
|
|
* @name setFillRadialGradientStartPoint
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number|Array|Object} startPoint
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set fill radial gradient end point
|
|
|
|
* @name setFillRadialGradientEndPoint
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number|Array|Object} endPoint
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set shadow offset
|
|
|
|
* @name setShadowOffset
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
* @param {Number|Array|Object} offset
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill pattern offset
|
|
|
|
* @name getFillPatternOffset
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill pattern scale
|
|
|
|
* @name getFillPatternScale
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill linear gradient start point
|
|
|
|
* @name getFillLinearGradientStartPoint
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill linear gradient end point
|
|
|
|
* @name getFillLinearGradientEndPoint
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill radial gradient start point
|
|
|
|
* @name getFillRadialGradientStartPoint
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill radial gradient end point
|
|
|
|
* @name getFillRadialGradientEndPoint
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
2012-12-31 16:45:38 +08:00
|
|
|
/**
|
|
|
|
* get shadow offset
|
|
|
|
* @name getShadowOffset
|
2012-11-14 14:54:08 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
2012-04-15 07:27:00 +08:00
|
|
|
|
2013-01-03 13:35:51 +08:00
|
|
|
Kinetic.Node.addRotationGettersSetters(Kinetic.Shape, ['fillPatternRotation']);
|
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
2013-01-03 13:35:51 +08:00
|
|
|
* set fill pattern rotation in radians
|
|
|
|
* @name setFillPatternRotation
|
2012-11-14 14:54:08 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2013-01-03 13:35:51 +08:00
|
|
|
* @param {Number} rotation
|
2012-11-14 14:54:08 +08:00
|
|
|
*/
|
2012-08-11 13:33:22 +08:00
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
/**
|
2013-01-03 13:35:51 +08:00
|
|
|
* set fill pattern rotation in degrees
|
|
|
|
* @name setFillPatternRotationDeg
|
2012-11-14 14:54:08 +08:00
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2013-01-03 13:35:51 +08:00
|
|
|
* @param {Number} rotationDeg
|
2012-11-14 14:54:08 +08:00
|
|
|
*/
|
2012-12-09 02:21:52 +08:00
|
|
|
|
|
|
|
/**
|
2013-01-03 13:35:51 +08:00
|
|
|
* get fill pattern rotation in radians
|
|
|
|
* @name getFillPatternRotation
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
2012-12-09 02:21:52 +08:00
|
|
|
*/
|
2013-01-03 13:35:51 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* get fill pattern rotation in degrees
|
|
|
|
* @name getFillPatternRotationDeg
|
|
|
|
* @methodOf Kinetic.Shape.prototype
|
|
|
|
*/
|
|
|
|
|
2012-11-14 14:54:08 +08:00
|
|
|
})();
|