From 4e526eb3da5d225378c5a34d1d3c442c7fa664c1 Mon Sep 17 00:00:00 2001 From: Eric Rowell Date: Thu, 12 Dec 2013 21:20:29 -0800 Subject: [PATCH] changed AnnularSection to Arc --- Gruntfile.js | 2 +- src/shapes/{AnnularSection.js => Arc.js} | 46 +++++++++---------- test/runner.html | 2 +- .../{AnnularSection-test.js => Arc-test.js} | 18 ++++---- 4 files changed, 34 insertions(+), 34 deletions(-) rename src/shapes/{AnnularSection.js => Arc.js} (62%) rename test/unit/shapes/{AnnularSection-test.js => Arc-test.js} (74%) diff --git a/Gruntfile.js b/Gruntfile.js index 923eb9e4..ea767943 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -21,7 +21,7 @@ module.exports = function(grunt) { 'src/shapes/Circle.js', 'src/shapes/Ellipse.js', 'src/shapes/Wedge.js', - 'src/shapes/AnnularSection.js', + 'src/shapes/Arc.js', 'src/shapes/Image.js', 'src/shapes/Text.js', 'src/shapes/Line.js', diff --git a/src/shapes/AnnularSection.js b/src/shapes/Arc.js similarity index 62% rename from src/shapes/AnnularSection.js rename to src/shapes/Arc.js index e939f0de..d4206b0f 100644 --- a/src/shapes/AnnularSection.js +++ b/src/shapes/Arc.js @@ -1,6 +1,6 @@ (function() { /** - * AnnularSection constructor + * Arc constructor * @constructor * @augments Kinetic.Shape * @param {Object} config @@ -12,8 +12,8 @@ * @@shapeParams * @@nodeParams * @example - * // draw a AnnularSection that's pointing downwards
- * var AnnularSection = new Kinetic.AnnularSection({
+ * // draw a Arc that's pointing downwards
+ * var Arc = new Kinetic.Arc({
* innerRadius: 40,
* outerRadius: 80,
* fill: 'red',
@@ -23,15 +23,15 @@ * rotationDeg: -120
* }); */ - Kinetic.AnnularSection = function(config) { + Kinetic.Arc = function(config) { this.___init(config); }; - Kinetic.AnnularSection.prototype = { + Kinetic.Arc.prototype = { ___init: function(config) { // call super constructor Kinetic.Shape.call(this, config); - this.className = 'AnnularSection'; + this.className = 'Arc'; }, drawFunc: function(context) { context.beginPath(); @@ -41,10 +41,10 @@ context.fillStrokeShape(this); } }; - Kinetic.Util.extend(Kinetic.AnnularSection, Kinetic.Shape); + Kinetic.Util.extend(Kinetic.Arc, Kinetic.Shape); // add getters setters - Kinetic.Factory.addGetterSetter(Kinetic.AnnularSection, 'innerRadius', function() { + Kinetic.Factory.addGetterSetter(Kinetic.Arc, 'innerRadius', function() { return 0; }); @@ -52,7 +52,7 @@ * set innerRadius * @name setInnerRadius * @method - * @memberof Kinetic.AnnularSection.prototype + * @memberof Kinetic.Arc.prototype * @param {Number} innerRadius */ @@ -60,11 +60,11 @@ * get innerRadius * @name getInnerRadius * @method - * @memberof Kinetic.AnnularSection.prototype + * @memberof Kinetic.Arc.prototype * @returns {Number} */ - Kinetic.Factory.addGetterSetter(Kinetic.AnnularSection, 'outerRadius', function() { + Kinetic.Factory.addGetterSetter(Kinetic.Arc, 'outerRadius', function() { return 0; }); @@ -72,7 +72,7 @@ * set outerRadius * @name setOuterRadius * @method - * @memberof Kinetic.AnnularSection.prototype + * @memberof Kinetic.Arc.prototype * @param {Number} innerRadius */ @@ -80,17 +80,17 @@ * get outerRadius * @name getOuterRadius * @method - * @memberof Kinetic.AnnularSection.prototype + * @memberof Kinetic.Arc.prototype * @returns {Number} */ - Kinetic.Factory.addRotationGetterSetter(Kinetic.AnnularSection, 'angle', 0); + Kinetic.Factory.addRotationGetterSetter(Kinetic.Arc, 'angle', 0); /** * set angle * @name setAngle * @method - * @memberof Kinetic.AnnularSection.prototype + * @memberof Kinetic.Arc.prototype * @param {Number} angle */ @@ -98,7 +98,7 @@ * set angle in degrees * @name setAngleDeg * @method - * @memberof Kinetic.AnnularSection.prototype + * @memberof Kinetic.Arc.prototype * @param {Number} angleDeg */ @@ -106,7 +106,7 @@ * get angle * @name getAngle * @method - * @memberof Kinetic.AnnularSection.prototype + * @memberof Kinetic.Arc.prototype * @returns {Number} */ @@ -114,18 +114,18 @@ * get angle in degrees * @name getAngleDeg * @method - * @memberof Kinetic.AnnularSection.prototype + * @memberof Kinetic.Arc.prototype * @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 - * If set to false, the AnnularSection will be drawn anti-clockwise. The default is false. + * set clockwise draw direction. If set to true, the Arc will be drawn clockwise + * If set to false, the Arc will be drawn anti-clockwise. The default is false. * @name setClockwise * @method - * @memberof Kinetic.AnnularSection.prototype + * @memberof Kinetic.Arc.prototype * @param {Boolean} clockwise */ @@ -133,7 +133,7 @@ * get clockwise * @name getClockwise * @method - * @memberof Kinetic.AnnularSection.prototype + * @memberof Kinetic.Arc.prototype * @returns {Boolean} */ })(); diff --git a/test/runner.html b/test/runner.html index 53ef47fb..f1e420dc 100644 --- a/test/runner.html +++ b/test/runner.html @@ -63,7 +63,7 @@ - + diff --git a/test/unit/shapes/AnnularSection-test.js b/test/unit/shapes/Arc-test.js similarity index 74% rename from test/unit/shapes/AnnularSection-test.js rename to test/unit/shapes/Arc-test.js index abdb4277..a237a96d 100644 --- a/test/unit/shapes/AnnularSection-test.js +++ b/test/unit/shapes/Arc-test.js @@ -1,9 +1,9 @@ suite('AnnularSection', function() { // ====================================================== - test('add annular section', function() { + test('add arc', function() { var stage = addStage(); var layer = new Kinetic.Layer(); - var annularsection = new Kinetic.AnnularSection({ + var arc = new Kinetic.Arc({ x: 100, y: 100, innerRadius: 50, @@ -12,14 +12,14 @@ suite('AnnularSection', function() { fill: 'green', stroke: 'black', strokeWidth: 4, - name: 'myAnnularSection', + name: 'myArc', draggable: true }); - layer.add(annularsection); + layer.add(arc); stage.add(layer); - assert.equal(annularsection.getClassName(), 'AnnularSection'); + assert.equal(arc.getClassName(), 'Arc'); var trace = layer.getContext().getTrace(); //console.log(trace); @@ -30,7 +30,7 @@ suite('AnnularSection', function() { test('set annular section angle using degrees', function() { var stage = addStage(); var layer = new Kinetic.Layer(); - var annularsection = new Kinetic.AnnularSection({ + var arc = new Kinetic.Arc({ x: 100, y: 100, innerRadius: 50, @@ -39,14 +39,14 @@ suite('AnnularSection', function() { fill: 'green', stroke: 'black', strokeWidth: 4, - name: 'myAnnularSection', + name: 'myArc', draggable: true, lineJoin: 'round' }); - layer.add(annularsection); + layer.add(arc); stage.add(layer); - assert.equal(annularsection.getAngle(), Math.PI / 2); + assert.equal(arc.getAngle(), Math.PI / 2); }); }); \ No newline at end of file