Update JSDoc on Display (object types)

This commit is contained in:
orblazer 2018-03-19 16:22:51 +01:00
parent 876911fd32
commit 94d92910cb
6 changed files with 45 additions and 28 deletions

View file

@ -81,7 +81,7 @@ var Color = new Class({
* An array containing the calculated color values for WebGL use. * An array containing the calculated color values for WebGL use.
* *
* @name Phaser.Display.Color#gl * @name Phaser.Display.Color#gl
* @type {array} * @type {[number,number,number,number]}
* @since 3.0.0 * @since 3.0.0
*/ */
this.gl = [ 0, 0, 0, 1 ]; this.gl = [ 0, 0, 0, 1 ];
@ -196,7 +196,7 @@ var Color = new Class({
* @method Phaser.Display.Color#setFromRGB * @method Phaser.Display.Color#setFromRGB
* @since 3.0.0 * @since 3.0.0
* *
* @param {object} color - An object containing `r`, `g`, `b` and optionally `a` values in the range 0 to 255. * @param {InputColorObject} color - An object containing `r`, `g`, `b` and optionally `a` values in the range 0 to 255.
* *
* @return {Phaser.Display.Color} This Color object. * @return {Phaser.Display.Color} This Color object.
*/ */
@ -399,7 +399,7 @@ var Color = new Class({
* The red color value, normalized to the range 0 to 255. * The red color value, normalized to the range 0 to 255.
* *
* @name Phaser.Display.Color#red * @name Phaser.Display.Color#red
* @type {float} * @type {number}
* @since 3.0.0 * @since 3.0.0
*/ */
red: { red: {
@ -426,7 +426,7 @@ var Color = new Class({
* The green color value, normalized to the range 0 to 255. * The green color value, normalized to the range 0 to 255.
* *
* @name Phaser.Display.Color#green * @name Phaser.Display.Color#green
* @type {float} * @type {number}
* @since 3.0.0 * @since 3.0.0
*/ */
green: { green: {
@ -453,7 +453,7 @@ var Color = new Class({
* The blue color value, normalized to the range 0 to 255. * The blue color value, normalized to the range 0 to 255.
* *
* @name Phaser.Display.Color#blue * @name Phaser.Display.Color#blue
* @type {float} * @type {number}
* @since 3.0.0 * @since 3.0.0
*/ */
blue: { blue: {
@ -480,7 +480,7 @@ var Color = new Class({
* The alpha color value, normalized to the range 0 to 255. * The alpha color value, normalized to the range 0 to 255.
* *
* @name Phaser.Display.Color#alpha * @name Phaser.Display.Color#alpha
* @type {float} * @type {number}
* @since 3.0.0 * @since 3.0.0
*/ */
alpha: { alpha: {

View file

@ -4,14 +4,6 @@
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/ */
/**
* @typedef {Object} ColorObject
* @property {number} r - The red color value in the range 0 to 255.
* @property {number} g - The green color value in the range 0 to 255.
* @property {number} b - The blue color value in the range 0 to 255.
* @property {number} a - The alpha color value in the range 0 to 255.
*/
/** /**
* Converts the given color value into an Object containing r,g,b and a properties. * Converts the given color value into an Object containing r,g,b and a properties.
* *

View file

@ -12,7 +12,7 @@ var Color = require('./Color');
* @function Phaser.Display.Color.ObjectToColor * @function Phaser.Display.Color.ObjectToColor
* @since 3.0.0 * @since 3.0.0
* *
* @param {object} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255. * @param {InputColorObject} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255.
* *
* @return {Phaser.Display.Color} A Color object. * @return {Phaser.Display.Color} A Color object.
*/ */

View file

@ -4,6 +4,14 @@
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/ */
/**
* @typedef {object} HSLColorObject
*
* @property {number} h - The hue color value. A number between 0 and 1
* @property {number} s - The saturation color value. A number between 0 and 1
* @property {number} l - The lightness color value. A number between 0 and 1
*/
/** /**
* Converts an RGB color value to HSV (hue, saturation and value). * Converts an RGB color value to HSV (hue, saturation and value).
* Conversion forumla from http://en.wikipedia.org/wiki/HSL_color_space. * Conversion forumla from http://en.wikipedia.org/wiki/HSL_color_space.
@ -17,7 +25,7 @@
* @param {integer} g - The green color value. A number between 0 and 255. * @param {integer} g - The green color value. A number between 0 and 255.
* @param {integer} b - The blue color value. A number between 0 and 255. * @param {integer} b - The blue color value. A number between 0 and 255.
* *
* @return {object} An object with the properties `h`, `s` and `v`. * @return {HSLColorObject} An object with the properties `h`, `s` and `v`.
*/ */
var RGBToHSV = function (r, g, b) var RGBToHSV = function (r, g, b)
{ {

View file

@ -16,7 +16,7 @@ var RGBStringToColor = require('./RGBStringToColor');
* @function Phaser.Display.Color.ValueToColor * @function Phaser.Display.Color.ValueToColor
* @since 3.0.0 * @since 3.0.0
* *
* @param {string|number|object} input - The source color value to convert. * @param {string|number|InputColorObject} input - The source color value to convert.
* *
* @return {Phaser.Display.Color} A Color object. * @return {Phaser.Display.Color} A Color object.
*/ */

View file

@ -4,6 +4,23 @@
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/ */
/**
* @typedef {object} InputColorObject
*
* @property {number} [r] - The red color value in the range 0 to 255.
* @property {number} [g] - The green color value in the range 0 to 255.
* @property {number} [b] - The blue color value in the range 0 to 255.
* @property {number} [a] - The alpha color value in the range 0 to 255.
*/
/**
* @typedef {Object} ColorObject
* @property {number} r - The red color value in the range 0 to 255.
* @property {number} g - The green color value in the range 0 to 255.
* @property {number} b - The blue color value in the range 0 to 255.
* @property {number} a - The alpha color value in the range 0 to 255.
*/
/** /**
* @namespace Phaser.Display.Color * @namespace Phaser.Display.Color
*/ */