Skip to content

Commit 7d5adab

Browse files
committed
Added JSDocs
1 parent 9ec300d commit 7d5adab

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

src/display/RGB.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ var RGB = new Class({
6060
this.set(red, green, blue);
6161
},
6262

63+
/**
64+
* Sets the red, green and blue values of this RGB object, flags it as being
65+
* dirty and then invokes the `onChangeCallback`, if set.
66+
*
67+
* @method Phaser.Display.RGB#set
68+
* @since 3.50.0
69+
*
70+
* @param {number} [red=0] - The red color value. A number between 0 and 1.
71+
* @param {number} [green=0] - The green color value. A number between 0 and 1.
72+
* @param {number} [blue=0] - The blue color value. A number between 0 and 1.
73+
*
74+
* @return {this} This RGB instance.
75+
*/
6376
set: function (red, green, blue)
6477
{
6578
if (red === undefined) { red = 0; }
@@ -73,13 +86,34 @@ var RGB = new Class({
7386
return this;
7487
},
7588

89+
/**
90+
* Compares the given rgb parameters with those in this object and returns
91+
* a boolean `true` value if they are equal, otherwise it returns `false`.
92+
*
93+
* @method Phaser.Display.RGB#equals
94+
* @since 3.50.0
95+
*
96+
* @param {number} red - The red value to compare with this object.
97+
* @param {number} green - The green value to compare with this object.
98+
* @param {number} blue - The blue value to compare with this object.
99+
*
100+
* @return {boolean} `true` if the given values match those in this object, otherwise `false`.
101+
*/
76102
equals: function (red, green, blue)
77103
{
78104
var rgb = this._rgb;
79105

80106
return (rgb.r === red && rgb.g === green && rgb.b === blue);
81107
},
82108

109+
/**
110+
* Internal on change handler. Sets this object as being dirty and
111+
* then invokes the `onChangeCallback`, if set, passing in the
112+
* new RGB values.
113+
*
114+
* @method Phaser.Display.RGB#onChange
115+
* @since 3.50.0
116+
*/
83117
onChange: function ()
84118
{
85119
this.dirty = true;
@@ -89,6 +123,16 @@ var RGB = new Class({
89123
this.onChangeCallback.call(this, rgb[0], rgb[1], rgb[2]);
90124
},
91125

126+
/**
127+
* The red color value. Between 0 and 1.
128+
*
129+
* Changing this property will flag this RGB object as being dirty
130+
* and invoke the `onChangeCallback` , if set.
131+
*
132+
* @name Phaser.Display.RGB#r
133+
* @type {number}
134+
* @since 3.50.0
135+
*/
92136
r: {
93137

94138
get: function ()
@@ -104,6 +148,16 @@ var RGB = new Class({
104148

105149
},
106150

151+
/**
152+
* The green color value. Between 0 and 1.
153+
*
154+
* Changing this property will flag this RGB object as being dirty
155+
* and invoke the `onChangeCallback` , if set.
156+
*
157+
* @name Phaser.Display.RGB#g
158+
* @type {number}
159+
* @since 3.50.0
160+
*/
107161
g: {
108162

109163
get: function ()
@@ -119,6 +173,16 @@ var RGB = new Class({
119173

120174
},
121175

176+
/**
177+
* The blue color value. Between 0 and 1.
178+
*
179+
* Changing this property will flag this RGB object as being dirty
180+
* and invoke the `onChangeCallback` , if set.
181+
*
182+
* @name Phaser.Display.RGB#b
183+
* @type {number}
184+
* @since 3.50.0
185+
*/
122186
b: {
123187

124188
get: function ()

0 commit comments

Comments
 (0)