Skip to content

Commit abf63cc

Browse files
committed
Update JSDoc on Curves
1 parent e2ab82c commit abf63cc

9 files changed

Lines changed: 55 additions & 24 deletions

File tree

src/curves/CubicBezierCurve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ var CubicBezierCurve = new Class({
173173
* @method Phaser.Curves.CubicBezierCurve#toJSON
174174
* @since 3.0.0
175175
*
176-
* @return {object} [description]
176+
* @return {JSONCurve} The JSON object containing this curve data.
177177
*/
178178
toJSON: function ()
179179
{
@@ -196,7 +196,7 @@ var CubicBezierCurve = new Class({
196196
* @function Phaser.Curves.CubicBezierCurve.fromJSON
197197
* @since 3.0.0
198198
*
199-
* @param {object} data - The JSON object containing this curve data.
199+
* @param {JSONCurve} data - The JSON object containing this curve data.
200200
*
201201
* @return {Phaser.Curves.CubicBezierCurve} [description]
202202
*/

src/curves/Curve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var Curve = new Class({
6161
* An array of cached arc length values.
6262
*
6363
* @name Phaser.Curves.Curve#cacheArcLengths
64-
* @type {array}
64+
* @type {number[]}
6565
* @default []
6666
* @since 3.0.0
6767
*/
@@ -110,7 +110,7 @@ var Curve = new Class({
110110

111111
/**
112112
* Draws this curve on the given Graphics object.
113-
*
113+
*
114114
* The curve is drawn using `Graphics.strokePoints` so will be drawn at whatever the present Graphics stroke color is.
115115
* The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it.
116116
*

src/curves/EllipseCurve.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ var GetValue = require('../utils/object/GetValue');
1313
var RadToDeg = require('../math/RadToDeg');
1414
var Vector2 = require('../math/Vector2');
1515

16+
/**
17+
* @typedef {object} JSONEllipseCurve
18+
*
19+
* @property {string} type - The of the curve.
20+
* @property {number} x - [description]
21+
* @property {number} y - [description]
22+
* @property {number} xRadius - The horizontal radius of ellipse.
23+
* @property {number} yRadius - The vertical radius of ellipse.
24+
* @property {integer} startAngle - The start angle of ellipse.
25+
* @property {integer} endAngle - The end angle of ellipse.
26+
* @property {boolean} clockwise - The clockwise of ellipse.
27+
* @property {integer} rotation - The rotation of ellipse.
28+
*/
29+
1630
/**
1731
* @classdesc
1832
* [description]
@@ -69,7 +83,7 @@ var EllipseCurve = new Class({
6983
/**
7084
* [description]
7185
*
72-
* @name {Phaser.MathPhaser.Curves.EllipseCurve#p0
86+
* @name {Phaser.Curves.EllipseCurve#p0
7387
* @type {Phaser.Math.Vector2}
7488
* @since 3.0.0
7589
*/
@@ -510,7 +524,7 @@ var EllipseCurve = new Class({
510524
* [description]
511525
*
512526
* @name Phaser.Curves.EllipseCurve#clockwise
513-
* @type {number}
527+
* @type {boolean}
514528
* @since 3.0.0
515529
*/
516530
clockwise: {
@@ -554,7 +568,7 @@ var EllipseCurve = new Class({
554568
* @method Phaser.Curves.EllipseCurve#toJSON
555569
* @since 3.0.0
556570
*
557-
* @return {object} [description]
571+
* @return {JSONEllipseCurve} The JSON object containing this curve data.
558572
*/
559573
toJSON: function ()
560574
{
@@ -579,7 +593,7 @@ var EllipseCurve = new Class({
579593
* @function Phaser.Curves.EllipseCurve.fromJSON
580594
* @since 3.0.0
581595
*
582-
* @param {object} data - The JSON object containing this curve data.
596+
* @param {JSONEllipseCurve} data - The JSON object containing this curve data.
583597
*
584598
* @return {Phaser.Curves.EllipseCurve} [description]
585599
*/

src/curves/LineCurve.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ var LineCurve = new Class({
172172

173173
/**
174174
* Draws this curve on the given Graphics object.
175-
*
175+
*
176176
* The curve is drawn using `Graphics.lineBetween` so will be drawn at whatever the present Graphics line color is.
177177
* The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it.
178178
*
@@ -197,7 +197,7 @@ var LineCurve = new Class({
197197
* @method Phaser.Curves.LineCurve#toJSON
198198
* @since 3.0.0
199199
*
200-
* @return {object} [description]
200+
* @return {JSONCurve} The JSON object containing this curve data.
201201
*/
202202
toJSON: function ()
203203
{
@@ -218,7 +218,7 @@ var LineCurve = new Class({
218218
* @function Phaser.Curves.LineCurve.fromJSON
219219
* @since 3.0.0
220220
*
221-
* @param {object} data - The JSON object containing this curve data.
221+
* @param {JSONCurve} data - The JSON object containing this curve data.
222222
*
223223
* @return {Phaser.Curves.LineCurve} [description]
224224
*/

src/curves/QuadraticBezierCurve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ var QuadraticBezier = new Class({
162162
* @method Phaser.Curves.QuadraticBezier#toJSON
163163
* @since 3.2.0
164164
*
165-
* @return {object} [description]
165+
* @return {JSONCurve} The JSON object containing this curve data.
166166
*/
167167
toJSON: function ()
168168
{
@@ -184,7 +184,7 @@ var QuadraticBezier = new Class({
184184
* @function Phaser.Curves.QuadraticBezier.fromJSON
185185
* @since 3.2.0
186186
*
187-
* @param {object} data - The JSON object containing this curve data.
187+
* @param {JSONCurve} data - The JSON object containing this curve data.
188188
*
189189
* @return {Phaser.Curves.QuadraticBezier} [description]
190190
*/

src/curves/SplineCurve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ var SplineCurve = new Class({
177177
* @method Phaser.Curves.SplineCurve#toJSON
178178
* @since 3.0.0
179179
*
180-
* @return {object} [description]
180+
* @return {JSONCurve} The JSON object containing this curve data.
181181
*/
182182
toJSON: function ()
183183
{
@@ -203,7 +203,7 @@ var SplineCurve = new Class({
203203
* @function Phaser.Curves.SplineCurve.fromJSON
204204
* @since 3.0.0
205205
*
206-
* @param {object} data - The JSON object containing this curve data.
206+
* @param {JSONCurve} data - The JSON object containing this curve data.
207207
*
208208
* @return {Phaser.Curves.SplineCurve} [description]
209209
*/

src/curves/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
* @namespace Phaser.Curves
99
*/
1010

11+
/**
12+
* @typedef {object} JSONCurve
13+
*
14+
* @property {string} type - The of the curve
15+
* @property {number[]} points - The arrays of points like `[x1, y1, x2, y2]`
16+
*/
17+
1118
module.exports = {
1219
Path: require('./path/Path'),
1320

src/curves/path/MoveTo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ var MoveTo = new Class({
113113
* @method Phaser.Curves.MoveTo#toJSON
114114
* @since 3.0.0
115115
*
116-
* @return {object} [description]
116+
* @return {JSONCurve} [description]
117117
*/
118118
toJSON: function ()
119119
{

src/curves/path/Path.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ var Rectangle = require('../../geom/rectangle/Rectangle');
1717
var SplineCurve = require('../SplineCurve');
1818
var Vector2 = require('../../math/Vector2');
1919

20+
/**
21+
* @typedef {object} JSONPath
22+
*
23+
* @property {string} type - The of the curve.
24+
* @property {number} x - [description]
25+
* @property {number} y - [description]
26+
* @property {boolean} autoClose - The path is auto closed.
27+
* @property {JSONCurve[]} curves - The list of the curves
28+
*/
29+
2030
/**
2131
* @classdesc
2232
* [description]
@@ -52,7 +62,7 @@ var Path = new Class({
5262
* [description]
5363
*
5464
* @name Phaser.Curves.Path#curves
55-
* @type {array}
65+
* @type {Phaser.Curves.Curve[]}
5666
* @default []
5767
* @since 3.0.0
5868
*/
@@ -62,7 +72,7 @@ var Path = new Class({
6272
* [description]
6373
*
6474
* @name Phaser.Curves.Path#cacheLengths
65-
* @type {array}
75+
* @type {number[]}
6676
* @default []
6777
* @since 3.0.0
6878
*/
@@ -81,7 +91,7 @@ var Path = new Class({
8191
/**
8292
* [description]
8393
*
84-
* @name {Phaser.MathPhaser.Curves.Path#startPoint
94+
* @name {Phaser.Curves.Path#startPoint
8595
* @type {Phaser.Math.Vector2}
8696
* @since 3.0.0
8797
*/
@@ -90,7 +100,7 @@ var Path = new Class({
90100
/**
91101
* [description]
92102
*
93-
* @name {Phaser.MathPhaser.Curves.Path#_tmpVec2A
103+
* @name {Phaser.Curves.Path#_tmpVec2A
94104
* @type {Phaser.Math.Vector2}
95105
* @private
96106
* @since 3.0.0
@@ -100,7 +110,7 @@ var Path = new Class({
100110
/**
101111
* [description]
102112
*
103-
* @name {Phaser.MathPhaser.Curves.Path#_tmpVec2B
113+
* @name {Phaser.Curves.Path#_tmpVec2B
104114
* @type {Phaser.Math.Vector2}
105115
* @private
106116
* @since 3.0.0
@@ -781,7 +791,7 @@ var Path = new Class({
781791
*
782792
* @param {number} x - The horizontal position of this Path.
783793
* @param {number} y - The vertical position of this Path.
784-
*
794+
*
785795
* @return {Phaser.Curves.Path} The Path Object that was created.
786796
*/
787797
GameObjectFactory.register('path', function (x, y)
@@ -790,9 +800,9 @@ GameObjectFactory.register('path', function (x, y)
790800
});
791801

792802
// When registering a factory function 'this' refers to the GameObjectFactory context.
793-
//
803+
//
794804
// There are several properties available to use:
795-
//
805+
//
796806
// this.scene - a reference to the Scene that owns the GameObjectFactory
797807
// this.displayList - a reference to the Display List the Scene owns
798808
// this.updateList - a reference to the Update List the Scene owns

0 commit comments

Comments
 (0)