Skip to content

Commit 94d9291

Browse files
committed
Update JSDoc on Display (object types)
1 parent 876911f commit 94d9291

6 files changed

Lines changed: 45 additions & 28 deletions

File tree

src/display/color/Color.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ var Color = new Class({
8181
* An array containing the calculated color values for WebGL use.
8282
*
8383
* @name Phaser.Display.Color#gl
84-
* @type {array}
84+
* @type {[number,number,number,number]}
8585
* @since 3.0.0
8686
*/
8787
this.gl = [ 0, 0, 0, 1 ];
@@ -196,7 +196,7 @@ var Color = new Class({
196196
* @method Phaser.Display.Color#setFromRGB
197197
* @since 3.0.0
198198
*
199-
* @param {object} color - An object containing `r`, `g`, `b` and optionally `a` values in the range 0 to 255.
199+
* @param {InputColorObject} color - An object containing `r`, `g`, `b` and optionally `a` values in the range 0 to 255.
200200
*
201201
* @return {Phaser.Display.Color} This Color object.
202202
*/
@@ -246,7 +246,7 @@ var Color = new Class({
246246

247247
/**
248248
* The color of this Color component, not including the alpha channel.
249-
*
249+
*
250250
* @name Phaser.Display.Color#color
251251
* @type {number}
252252
* @readOnly
@@ -263,7 +263,7 @@ var Color = new Class({
263263

264264
/**
265265
* The color of this Color component, including the alpha channel.
266-
*
266+
*
267267
* @name Phaser.Display.Color#color32
268268
* @type {number}
269269
* @readOnly
@@ -280,7 +280,7 @@ var Color = new Class({
280280

281281
/**
282282
* The color of this Color component as a string which can be used in CSS color values.
283-
*
283+
*
284284
* @name Phaser.Display.Color#rgba
285285
* @type {string}
286286
* @readOnly
@@ -297,7 +297,7 @@ var Color = new Class({
297297

298298
/**
299299
* The red color value, normalized to the range 0 to 1.
300-
*
300+
*
301301
* @name Phaser.Display.Color#redGL
302302
* @type {float}
303303
* @since 3.0.0
@@ -322,7 +322,7 @@ var Color = new Class({
322322

323323
/**
324324
* The green color value, normalized to the range 0 to 1.
325-
*
325+
*
326326
* @name Phaser.Display.Color#greenGL
327327
* @type {float}
328328
* @since 3.0.0
@@ -347,7 +347,7 @@ var Color = new Class({
347347

348348
/**
349349
* The blue color value, normalized to the range 0 to 1.
350-
*
350+
*
351351
* @name Phaser.Display.Color#blueGL
352352
* @type {float}
353353
* @since 3.0.0
@@ -372,7 +372,7 @@ var Color = new Class({
372372

373373
/**
374374
* The alpha color value, normalized to the range 0 to 1.
375-
*
375+
*
376376
* @name Phaser.Display.Color#alphaGL
377377
* @type {float}
378378
* @since 3.0.0
@@ -397,9 +397,9 @@ var Color = new Class({
397397

398398
/**
399399
* The red color value, normalized to the range 0 to 255.
400-
*
400+
*
401401
* @name Phaser.Display.Color#red
402-
* @type {float}
402+
* @type {number}
403403
* @since 3.0.0
404404
*/
405405
red: {
@@ -424,9 +424,9 @@ var Color = new Class({
424424

425425
/**
426426
* The green color value, normalized to the range 0 to 255.
427-
*
427+
*
428428
* @name Phaser.Display.Color#green
429-
* @type {float}
429+
* @type {number}
430430
* @since 3.0.0
431431
*/
432432
green: {
@@ -451,9 +451,9 @@ var Color = new Class({
451451

452452
/**
453453
* The blue color value, normalized to the range 0 to 255.
454-
*
454+
*
455455
* @name Phaser.Display.Color#blue
456-
* @type {float}
456+
* @type {number}
457457
* @since 3.0.0
458458
*/
459459
blue: {
@@ -478,9 +478,9 @@ var Color = new Class({
478478

479479
/**
480480
* The alpha color value, normalized to the range 0 to 255.
481-
*
481+
*
482482
* @name Phaser.Display.Color#alpha
483-
* @type {float}
483+
* @type {number}
484484
* @since 3.0.0
485485
*/
486486
alpha: {

src/display/color/ColorToRGBA.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
66

7-
/**
8-
* @typedef {Object} ColorObject
9-
* @property {number} r - The red color value in the range 0 to 255.
10-
* @property {number} g - The green color value in the range 0 to 255.
11-
* @property {number} b - The blue color value in the range 0 to 255.
12-
* @property {number} a - The alpha color value in the range 0 to 255.
13-
*/
14-
157
/**
168
* Converts the given color value into an Object containing r,g,b and a properties.
179
*

src/display/color/ObjectToColor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var Color = require('./Color');
1212
* @function Phaser.Display.Color.ObjectToColor
1313
* @since 3.0.0
1414
*
15-
* @param {object} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255.
15+
* @param {InputColorObject} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255.
1616
*
1717
* @return {Phaser.Display.Color} A Color object.
1818
*/

src/display/color/RGBToHSV.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
66

7+
/**
8+
* @typedef {object} HSLColorObject
9+
*
10+
* @property {number} h - The hue color value. A number between 0 and 1
11+
* @property {number} s - The saturation color value. A number between 0 and 1
12+
* @property {number} l - The lightness color value. A number between 0 and 1
13+
*/
14+
715
/**
816
* Converts an RGB color value to HSV (hue, saturation and value).
917
* Conversion forumla from http://en.wikipedia.org/wiki/HSL_color_space.
@@ -17,7 +25,7 @@
1725
* @param {integer} g - The green color value. A number between 0 and 255.
1826
* @param {integer} b - The blue color value. A number between 0 and 255.
1927
*
20-
* @return {object} An object with the properties `h`, `s` and `v`.
28+
* @return {HSLColorObject} An object with the properties `h`, `s` and `v`.
2129
*/
2230
var RGBToHSV = function (r, g, b)
2331
{

src/display/color/ValueToColor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var RGBStringToColor = require('./RGBStringToColor');
1616
* @function Phaser.Display.Color.ValueToColor
1717
* @since 3.0.0
1818
*
19-
* @param {string|number|object} input - The source color value to convert.
19+
* @param {string|number|InputColorObject} input - The source color value to convert.
2020
*
2121
* @return {Phaser.Display.Color} A Color object.
2222
*/

src/display/color/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
66

7+
/**
8+
* @typedef {object} InputColorObject
9+
*
10+
* @property {number} [r] - The red color value in the range 0 to 255.
11+
* @property {number} [g] - The green color value in the range 0 to 255.
12+
* @property {number} [b] - The blue color value in the range 0 to 255.
13+
* @property {number} [a] - The alpha color value in the range 0 to 255.
14+
*/
15+
16+
/**
17+
* @typedef {Object} ColorObject
18+
* @property {number} r - The red color value in the range 0 to 255.
19+
* @property {number} g - The green color value in the range 0 to 255.
20+
* @property {number} b - The blue color value in the range 0 to 255.
21+
* @property {number} a - The alpha color value in the range 0 to 255.
22+
*/
23+
724
/**
825
* @namespace Phaser.Display.Color
926
*/

0 commit comments

Comments
 (0)