Fix types and add generic in Curves

This commit is contained in:
orblazer 2018-03-27 14:06:24 +02:00
parent 7a33233013
commit 1ded1d12a8
8 changed files with 80 additions and 9 deletions

View file

@ -87,6 +87,8 @@ var CubicBezierCurve = new Class({
* @method Phaser.Curves.CubicBezierCurve#getStartPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
@ -119,6 +121,8 @@ var CubicBezierCurve = new Class({
* @method Phaser.Curves.CubicBezierCurve#getPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*
@ -142,6 +146,8 @@ var CubicBezierCurve = new Class({
* @method Phaser.Curves.CubicBezierCurve#draw
* @since 3.0.0
*
* @generic {Phaser.GameObjects.Graphics} G - [out,$return]
*
* @param {Phaser.GameObjects.Graphics} graphics - [description]
* @param {integer} [pointsTotal=32] - [description]
*

View file

@ -117,6 +117,8 @@ var Curve = new Class({
* @method Phaser.Curves.Curve#draw
* @since 3.0.0
*
* @generic {Phaser.GameObjects.Graphics} G - [out,$return]
*
* @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn.
* @param {integer} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance.
*
@ -274,6 +276,8 @@ var Curve = new Class({
* @method Phaser.Curves.Curve#getPointAt
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {float} u - [description]
* @param {Phaser.Math.Vector2} [out] - [description]
*
@ -318,6 +322,8 @@ var Curve = new Class({
* @method Phaser.Curves.Curve#getRandomPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Math.Vector2} [out] - [description]
*
* @return {Phaser.Math.Vector2} [description]
@ -363,6 +369,8 @@ var Curve = new Class({
* @method Phaser.Curves.Curve#getStartPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Math.Vector2} [out] - [description]
*
* @return {Phaser.Math.Vector2} [description]
@ -385,6 +393,8 @@ var Curve = new Class({
* @method Phaser.Curves.Curve#getTangent
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {number} t - [description]
* @param {Phaser.Math.Vector2} [out] - [description]
*
@ -422,6 +432,8 @@ var Curve = new Class({
* @method Phaser.Curves.Curve#getTangentAt
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {float} u - [description]
* @param {Phaser.Math.Vector2} [out] - [description]
*

View file

@ -27,6 +27,19 @@ var Vector2 = require('../math/Vector2');
* @property {integer} rotation - The rotation of ellipse.
*/
/**
* @typedef {object} EllipseCurveConfig
*
* @property {number} [x=0] - [description]
* @property {number} [y=0] - [description]
* @property {number} [xRadius=0] - [description]
* @property {number} [yRadius=0] - [description]
* @property {integer} [startAngle=0] - [description]
* @property {integer} [endAngle=360] - [description]
* @property {boolean} [clockwise=false] - [description]
* @property {integer} [rotation=0] - [description]
*/
/**
* @classdesc
* [description]
@ -37,14 +50,14 @@ var Vector2 = require('../math/Vector2');
* @constructor
* @since 3.0.0
*
* @param {number} [x=0] - [description]
* @param {(number|EllipseCurveConfig)} [x=0] - [description]
* @param {number} [y=0] - [description]
* @param {number} [xRadius=0] - [description]
* @param {number} [yRadius=0] - [description]
* @param {number} [startAngle=0] - [description]
* @param {number} [endAngle=360] - [description]
* @param {integer} [startAngle=0] - [description]
* @param {integer} [endAngle=360] - [description]
* @param {boolean} [clockwise=false] - [description]
* @param {number} [rotation=0] - [description]
* @param {integer} [rotation=0] - [description]
*/
var EllipseCurve = new Class({
@ -158,6 +171,8 @@ var EllipseCurve = new Class({
* @method Phaser.Curves.EllipseCurve#getStartPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
@ -190,6 +205,8 @@ var EllipseCurve = new Class({
* @method Phaser.Curves.EllipseCurve#getPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*

View file

@ -24,8 +24,8 @@ var tmpVec2 = new Vector2();
* @constructor
* @since 3.0.0
*
* @param {Phaser.Math.Vector2} p0 - [description]
* @param {Phaser.Math.Vector2} p1 - [description]
* @param {(Phaser.Math.Vector2|number[])} p0 - [description]
* @param {Phaser.Math.Vector2} [p1] - [description]
*/
var LineCurve = new Class({
@ -69,6 +69,8 @@ var LineCurve = new Class({
* @method Phaser.Curves.LineCurve#getBounds
* @since 3.0.0
*
* @generic {Phaser.Geom.Rectangle} O - [out,$return]
*
* @param {Phaser.Geom.Rectangle} [out] - A Rectangle object to store the bounds in. If not given a new Rectangle will be created.
*
* @return {Phaser.Geom.Rectangle} A Rectangle object holding the bounds of this curve. If `out` was given it will be this object.
@ -86,6 +88,8 @@ var LineCurve = new Class({
* @method Phaser.Curves.LineCurve#getStartPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
@ -116,6 +120,8 @@ var LineCurve = new Class({
* @method Phaser.Curves.LineCurve#getPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*
@ -143,6 +149,8 @@ var LineCurve = new Class({
* @method Phaser.Curves.LineCurve#getPointAt
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {float} u - The position along the curve to return. Where 0 is the start and 1 is the end.
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*
@ -179,6 +187,8 @@ var LineCurve = new Class({
* @method Phaser.Curves.LineCurve#draw
* @since 3.0.0
*
* @generic {Phaser.GameObjects.Graphics} G - [graphics,$return]
*
* @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn.
*
* @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn.

View file

@ -19,7 +19,7 @@ var Vector2 = require('../math/Vector2');
* @constructor
* @since 3.2.0
*
* @param {(Phaser.Math.Vector2|Phaser.Math.Vector2[])} p0 - Start point, or an array of point pairs.
* @param {(Phaser.Math.Vector2|number[])} p0 - Start point, or an array of point pairs.
* @param {Phaser.Math.Vector2} p1 - Control Point 1.
* @param {Phaser.Math.Vector2} p2 - Control Point 2.
*/
@ -74,6 +74,8 @@ var QuadraticBezier = new Class({
* @method Phaser.Curves.QuadraticBezier#getStartPoint
* @since 3.2.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
@ -106,6 +108,8 @@ var QuadraticBezier = new Class({
* @method Phaser.Curves.QuadraticBezier#getPoint
* @since 3.2.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*
@ -131,6 +135,8 @@ var QuadraticBezier = new Class({
* @method Phaser.Curves.QuadraticBezier#draw
* @since 3.2.0
*
* @generic {Phaser.GameObjects.Graphics} G - [graphics,$return]
*
* @param {Phaser.GameObjects.Graphics} graphics - [description]
* @param {integer} [pointsTotal=32] - [description]
*

View file

@ -54,7 +54,7 @@ var SplineCurve = new Class({
* @method Phaser.Curves.SplineCurve#addPoints
* @since 3.0.0
*
* @param {Phaser.Math.Vector2[]} points - [description]
* @param {(Phaser.Math.Vector2[]|number[]|number[][])} points - [description]
*
* @return {Phaser.Curves.SplineCurve} This curve object.
*/
@ -114,6 +114,8 @@ var SplineCurve = new Class({
* @method Phaser.Curves.SplineCurve#getStartPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*
* @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned.
@ -146,6 +148,8 @@ var SplineCurve = new Class({
* @method Phaser.Curves.SplineCurve#getPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*

View file

@ -53,6 +53,8 @@ var MoveTo = new Class({
* @method Phaser.Curves.MoveTo#getPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {float} t - The position along the curve to return. Where 0 is the start and 1 is the end.
* @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created.
*
@ -71,6 +73,8 @@ var MoveTo = new Class({
* @method Phaser.Curves.MoveTo#getPointAt
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {float} u - [description]
* @param {Phaser.Math.Vector2} [out] - [description]
*

View file

@ -269,6 +269,8 @@ var Path = new Class({
* @method Phaser.Curves.Path#draw
* @since 3.0.0
*
* @generic {Phaser.GameObjects.Graphics} G - [out,$return]
*
* @param {Phaser.GameObjects.Graphics} graphics - [description]
* @param {integer} [pointsTotal=32] - [description]
*
@ -381,6 +383,8 @@ var Path = new Class({
* @method Phaser.Curves.Path#getBounds
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Geom.Rectangle} [out] - [description]
* @param {integer} [accuracy=16] - [description]
*
@ -428,7 +432,7 @@ var Path = new Class({
* @method Phaser.Curves.Path#getCurveLengths
* @since 3.0.0
*
* @return {array} [description]
* @return {number[]} [description]
*/
getCurveLengths: function ()
{
@ -463,6 +467,8 @@ var Path = new Class({
* @method Phaser.Curves.Path#getEndPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Math.Vector2} [out] - [description]
*
* @return {Phaser.Math.Vector2} [description]
@ -513,6 +519,8 @@ var Path = new Class({
* @method Phaser.Curves.Path#getPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {number} t - [description]
* @param {Phaser.Math.Vector2} [out] - [description]
*
@ -606,6 +614,8 @@ var Path = new Class({
* @method Phaser.Curves.Path#getRandomPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Math.Vector2} [out] - [description]
*
* @return {Phaser.Math.Vector2} [description]
@ -652,6 +662,8 @@ var Path = new Class({
* @method Phaser.Curves.Path#getStartPoint
* @since 3.0.0
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
* @param {Phaser.Math.Vector2} [out] - [description]
*
* @return {Phaser.Math.Vector2} [description]