changed AnnularSection to Arc

This commit is contained in:
Eric Rowell 2013-12-12 21:20:29 -08:00
parent b32609c9c9
commit 4e526eb3da
4 changed files with 34 additions and 34 deletions

View File

@ -21,7 +21,7 @@ module.exports = function(grunt) {
'src/shapes/Circle.js', 'src/shapes/Circle.js',
'src/shapes/Ellipse.js', 'src/shapes/Ellipse.js',
'src/shapes/Wedge.js', 'src/shapes/Wedge.js',
'src/shapes/AnnularSection.js', 'src/shapes/Arc.js',
'src/shapes/Image.js', 'src/shapes/Image.js',
'src/shapes/Text.js', 'src/shapes/Text.js',
'src/shapes/Line.js', 'src/shapes/Line.js',

View File

@ -1,6 +1,6 @@
(function() { (function() {
/** /**
* AnnularSection constructor * Arc constructor
* @constructor * @constructor
* @augments Kinetic.Shape * @augments Kinetic.Shape
* @param {Object} config * @param {Object} config
@ -12,8 +12,8 @@
* @@shapeParams * @@shapeParams
* @@nodeParams * @@nodeParams
* @example * @example
* // draw a AnnularSection that's pointing downwards<br> * // draw a Arc that's pointing downwards<br>
* var AnnularSection = new Kinetic.AnnularSection({<br> * var Arc = new Kinetic.Arc({<br>
* innerRadius: 40,<br> * innerRadius: 40,<br>
* outerRadius: 80,<br> * outerRadius: 80,<br>
* fill: 'red',<br> * fill: 'red',<br>
@ -23,15 +23,15 @@
* rotationDeg: -120<br> * rotationDeg: -120<br>
* }); * });
*/ */
Kinetic.AnnularSection = function(config) { Kinetic.Arc = function(config) {
this.___init(config); this.___init(config);
}; };
Kinetic.AnnularSection.prototype = { Kinetic.Arc.prototype = {
___init: function(config) { ___init: function(config) {
// call super constructor // call super constructor
Kinetic.Shape.call(this, config); Kinetic.Shape.call(this, config);
this.className = 'AnnularSection'; this.className = 'Arc';
}, },
drawFunc: function(context) { drawFunc: function(context) {
context.beginPath(); context.beginPath();
@ -41,10 +41,10 @@
context.fillStrokeShape(this); context.fillStrokeShape(this);
} }
}; };
Kinetic.Util.extend(Kinetic.AnnularSection, Kinetic.Shape); Kinetic.Util.extend(Kinetic.Arc, Kinetic.Shape);
// add getters setters // add getters setters
Kinetic.Factory.addGetterSetter(Kinetic.AnnularSection, 'innerRadius', function() { Kinetic.Factory.addGetterSetter(Kinetic.Arc, 'innerRadius', function() {
return 0; return 0;
}); });
@ -52,7 +52,7 @@
* set innerRadius * set innerRadius
* @name setInnerRadius * @name setInnerRadius
* @method * @method
* @memberof Kinetic.AnnularSection.prototype * @memberof Kinetic.Arc.prototype
* @param {Number} innerRadius * @param {Number} innerRadius
*/ */
@ -60,11 +60,11 @@
* get innerRadius * get innerRadius
* @name getInnerRadius * @name getInnerRadius
* @method * @method
* @memberof Kinetic.AnnularSection.prototype * @memberof Kinetic.Arc.prototype
* @returns {Number} * @returns {Number}
*/ */
Kinetic.Factory.addGetterSetter(Kinetic.AnnularSection, 'outerRadius', function() { Kinetic.Factory.addGetterSetter(Kinetic.Arc, 'outerRadius', function() {
return 0; return 0;
}); });
@ -72,7 +72,7 @@
* set outerRadius * set outerRadius
* @name setOuterRadius * @name setOuterRadius
* @method * @method
* @memberof Kinetic.AnnularSection.prototype * @memberof Kinetic.Arc.prototype
* @param {Number} innerRadius * @param {Number} innerRadius
*/ */
@ -80,17 +80,17 @@
* get outerRadius * get outerRadius
* @name getOuterRadius * @name getOuterRadius
* @method * @method
* @memberof Kinetic.AnnularSection.prototype * @memberof Kinetic.Arc.prototype
* @returns {Number} * @returns {Number}
*/ */
Kinetic.Factory.addRotationGetterSetter(Kinetic.AnnularSection, 'angle', 0); Kinetic.Factory.addRotationGetterSetter(Kinetic.Arc, 'angle', 0);
/** /**
* set angle * set angle
* @name setAngle * @name setAngle
* @method * @method
* @memberof Kinetic.AnnularSection.prototype * @memberof Kinetic.Arc.prototype
* @param {Number} angle * @param {Number} angle
*/ */
@ -98,7 +98,7 @@
* set angle in degrees * set angle in degrees
* @name setAngleDeg * @name setAngleDeg
* @method * @method
* @memberof Kinetic.AnnularSection.prototype * @memberof Kinetic.Arc.prototype
* @param {Number} angleDeg * @param {Number} angleDeg
*/ */
@ -106,7 +106,7 @@
* get angle * get angle
* @name getAngle * @name getAngle
* @method * @method
* @memberof Kinetic.AnnularSection.prototype * @memberof Kinetic.Arc.prototype
* @returns {Number} * @returns {Number}
*/ */
@ -114,18 +114,18 @@
* get angle in degrees * get angle in degrees
* @name getAngleDeg * @name getAngleDeg
* @method * @method
* @memberof Kinetic.AnnularSection.prototype * @memberof Kinetic.Arc.prototype
* @returns {Number} * @returns {Number}
*/ */
Kinetic.Factory.addGetterSetter(Kinetic.AnnularSection, 'clockwise', false); Kinetic.Factory.addGetterSetter(Kinetic.Arc, 'clockwise', false);
/** /**
* set clockwise draw direction. If set to true, the AnnularSection will be drawn clockwise * set clockwise draw direction. If set to true, the Arc will be drawn clockwise
* If set to false, the AnnularSection will be drawn anti-clockwise. The default is false. * If set to false, the Arc will be drawn anti-clockwise. The default is false.
* @name setClockwise * @name setClockwise
* @method * @method
* @memberof Kinetic.AnnularSection.prototype * @memberof Kinetic.Arc.prototype
* @param {Boolean} clockwise * @param {Boolean} clockwise
*/ */
@ -133,7 +133,7 @@
* get clockwise * get clockwise
* @name getClockwise * @name getClockwise
* @method * @method
* @memberof Kinetic.AnnularSection.prototype * @memberof Kinetic.Arc.prototype
* @returns {Boolean} * @returns {Boolean}
*/ */
})(); })();

View File

@ -63,7 +63,7 @@
<script src="unit/shapes/Spline-test.js"></script> <script src="unit/shapes/Spline-test.js"></script>
<script src="unit/shapes/Sprite-test.js"></script> <script src="unit/shapes/Sprite-test.js"></script>
<script src="unit/shapes/Wedge-test.js"></script> <script src="unit/shapes/Wedge-test.js"></script>
<script src="unit/shapes/AnnularSection-test.js"></script> <script src="unit/shapes/Arc-test.js"></script>
<!-- extensions --> <!-- extensions -->
<script src="unit/Animation-test.js"></script> <script src="unit/Animation-test.js"></script>

View File

@ -1,9 +1,9 @@
suite('AnnularSection', function() { suite('AnnularSection', function() {
// ====================================================== // ======================================================
test('add annular section', function() { test('add arc', function() {
var stage = addStage(); var stage = addStage();
var layer = new Kinetic.Layer(); var layer = new Kinetic.Layer();
var annularsection = new Kinetic.AnnularSection({ var arc = new Kinetic.Arc({
x: 100, x: 100,
y: 100, y: 100,
innerRadius: 50, innerRadius: 50,
@ -12,14 +12,14 @@ suite('AnnularSection', function() {
fill: 'green', fill: 'green',
stroke: 'black', stroke: 'black',
strokeWidth: 4, strokeWidth: 4,
name: 'myAnnularSection', name: 'myArc',
draggable: true draggable: true
}); });
layer.add(annularsection); layer.add(arc);
stage.add(layer); stage.add(layer);
assert.equal(annularsection.getClassName(), 'AnnularSection'); assert.equal(arc.getClassName(), 'Arc');
var trace = layer.getContext().getTrace(); var trace = layer.getContext().getTrace();
//console.log(trace); //console.log(trace);
@ -30,7 +30,7 @@ suite('AnnularSection', function() {
test('set annular section angle using degrees', function() { test('set annular section angle using degrees', function() {
var stage = addStage(); var stage = addStage();
var layer = new Kinetic.Layer(); var layer = new Kinetic.Layer();
var annularsection = new Kinetic.AnnularSection({ var arc = new Kinetic.Arc({
x: 100, x: 100,
y: 100, y: 100,
innerRadius: 50, innerRadius: 50,
@ -39,14 +39,14 @@ suite('AnnularSection', function() {
fill: 'green', fill: 'green',
stroke: 'black', stroke: 'black',
strokeWidth: 4, strokeWidth: 4,
name: 'myAnnularSection', name: 'myArc',
draggable: true, draggable: true,
lineJoin: 'round' lineJoin: 'round'
}); });
layer.add(annularsection); layer.add(arc);
stage.add(layer); stage.add(layer);
assert.equal(annularsection.getAngle(), Math.PI / 2); assert.equal(arc.getAngle(), Math.PI / 2);
}); });
}); });