@@ -4,30 +4,114 @@ export default Checkbox;
44
55declare namespace Checkbox {
66 interface IConfig {
7- x : number , y : number ,
8- width : number , height : number ,
7+ /**
8+ * Initial x position.
9+ */
10+ x : number ,
11+ /**
12+ * Initial y position.
13+ */
14+ y : number ,
15+ /**
16+ * Initial width.
17+ */
18+ width : number ,
19+ /**
20+ * Initial height.
21+ */
22+ height : number ,
923
10- color ?: number , boxFillAlpha ?: number ,
11- uncheckedColor ?: number , uncheckedBoxFillAlpha ?: number ,
24+ /**
25+ * Checked box fill color.
26+ */
27+ color ?: number ,
28+ /**
29+ * Checked box fill alpha.
30+ */
31+ boxFillAlpha ?: number ,
32+ /**
33+ * Unchecked box fill color.
34+ */
35+ uncheckedColor ?: number ,
36+ /**
37+ * Unchecked box fill alpha.
38+ */
39+ uncheckedBoxFillAlpha ?: number ,
1240
13- boxLineWidth ?: number , boxStrokeColor ?: number , boxStrokeAlpha ?: number ,
14- uncheckedBoxStrokeColor ?: number , uncheckedBoxStrokeAlpha ?: number ,
41+ /**
42+ * Box stroke line width.
43+ */
44+ boxLineWidth ?: number ,
45+ /**
46+ * Box stroke color.
47+ */
48+ boxStrokeColor ?: number ,
49+ /**
50+ * Box stroke alpha.
51+ */
52+ boxStrokeAlpha ?: number ,
53+ /**
54+ * Unchecked box stroke color.
55+ */
56+ uncheckedBoxStrokeColor ?: number ,
57+ /**
58+ * Unchecked box stroke alpha.
59+ */
60+ uncheckedBoxStrokeAlpha ?: number ,
1561
62+ /**
63+ * Box size.
64+ */
1665 boxSize ?: number ,
66+ /**
67+ * Checker size.
68+ */
1769 checkerSize ?: number ,
1870
19- checkerColor ?: number , checkerAlpha ?: number ,
71+ /**
72+ * Checker color.
73+ */
74+ checkerColor ?: number ,
75+ /**
76+ * Checker alpha.
77+ */
78+ checkerAlpha ?: number ,
2079
80+ /**
81+ * True to render a circle box.
82+ */
2183 circleBox ?: boolean ,
2284
85+ /**
86+ * Checker animation duration.
87+ */
2388 animationDuration ?: number ,
2489
90+ /**
91+ * Checked state.
92+ */
2593 checked ?: boolean ,
94+ /**
95+ * Value state.
96+ */
2697 value ?: boolean ,
2798 }
2899}
29100
101+ /**
102+ * Checkbox shape built from custom shapes.
103+ */
30104declare class Checkbox extends BaseShapes {
105+ /**
106+ * Create a checkbox.
107+ * @param scene - The Scene to which this object belongs.
108+ * @param x - The x position.
109+ * @param y - The y position.
110+ * @param width - The width.
111+ * @param height - The height.
112+ * @param color - Checked color.
113+ * @param config - Configuration options.
114+ */
31115 constructor (
32116 scene : Phaser . Scene ,
33117 x : number , y : number ,
@@ -43,42 +127,152 @@ declare class Checkbox extends BaseShapes {
43127 config ?: Checkbox . IConfig
44128 ) ;
45129
130+ /**
131+ * Create a checkbox from config.
132+ * @param scene - The Scene to which this object belongs.
133+ * @param config - Configuration options.
134+ */
46135 constructor (
47136 scene : Phaser . Scene ,
48137 config ?: Checkbox . IConfig
49138 ) ;
50139
140+ /**
141+ * Set value state.
142+ * @param value - New value.
143+ * @returns This instance.
144+ */
51145 setValue ( value : boolean ) : this;
146+ /**
147+ * Toggle value state.
148+ * @returns This instance.
149+ */
52150 toggleValue ( ) : this;
151+ /**
152+ * Value state.
153+ */
53154 value : boolean ;
54155
156+ /**
157+ * Set checked state.
158+ * @param checked - New checked state.
159+ * @returns This instance.
160+ */
55161 setChecked ( checked ?: boolean ) : this;
162+ /**
163+ * Toggle checked state.
164+ * @returns This instance.
165+ */
56166 toggleChecked ( ) : this;
167+ /**
168+ * Checked state.
169+ */
57170 checked : boolean ;
58171
172+ /**
173+ * Set box shape to circle or square.
174+ * @param isCircleShape - True for circle box.
175+ * @returns This instance.
176+ */
59177 setBoxShape ( isCircleShape ?: boolean ) : this;
60178
179+ /**
180+ * Set checked box fill style.
181+ * @param color - Fill color.
182+ * @param alpha - Fill alpha.
183+ * @returns This instance.
184+ */
61185 setBoxFillStyle ( color : number , alpha ?: number ) : this;
186+ /**
187+ * Checked box fill color.
188+ */
62189 boxFillColor : number ;
190+ /**
191+ * Checked box fill alpha.
192+ */
63193 boxFillAlpha : number ;
194+ /**
195+ * Set unchecked box fill style.
196+ * @param color - Fill color.
197+ * @param alpha - Fill alpha.
198+ * @returns This instance.
199+ */
64200 setUncheckedBoxFillStyle ( color : number , alpha ?: number ) : this;
201+ /**
202+ * Unchecked box fill color.
203+ */
65204 uncheckedBoxFillColor : number ;
205+ /**
206+ * Unchecked box fill alpha.
207+ */
66208 uncheckedBoxFillAlpha : number ;
67209
210+ /**
211+ * Set box stroke style.
212+ * @param lineWidth - Line width.
213+ * @param color - Stroke color.
214+ * @param alpha - Stroke alpha.
215+ * @returns This instance.
216+ */
68217 setBoxStrokeStyle ( lineWidth : number , color : number , alpha ?: number ) : this;
218+ /**
219+ * Box line width.
220+ */
69221 boxLineWidth : number ;
222+ /**
223+ * Box stroke color.
224+ */
70225 boxStrokeColor : number ;
226+ /**
227+ * Box stroke alpha.
228+ */
71229 boxStrokeAlpha : number ;
72230
231+ /**
232+ * Set unchecked box stroke style.
233+ * @param lineWidth - Line width.
234+ * @param color - Stroke color.
235+ * @param alpha - Stroke alpha.
236+ * @returns This instance.
237+ */
73238 setUncheckedBoxStrokeStyle ( lineWidth : number , color : number , alpha ?: number ) : this;
239+ /**
240+ * Unchecked box line width.
241+ */
74242 uncheckedBoxLineWidth : number ;
243+ /**
244+ * Unchecked box stroke color.
245+ */
75246 uncheckedBoxStrokeColor : number ;
247+ /**
248+ * Unchecked box stroke alpha.
249+ */
76250 uncheckedBoxStrokeAlpha : number ;
77251
252+ /**
253+ * Set checker style.
254+ * @param color - Checker color.
255+ * @param alpha - Checker alpha.
256+ * @returns This instance.
257+ */
78258 setCheckerStyle ( color : number , alpha ?: number ) : this;
259+ /**
260+ * Checker color.
261+ */
79262 checkerColor : number ;
263+ /**
264+ * Checker alpha.
265+ */
80266 checkAlpha : number ;
81267
268+ /**
269+ * Set checker animation duration.
270+ * @param duration - Duration in ms.
271+ * @returns This instance.
272+ */
82273 setCheckerAnimationDuration ( duration : number ) : this;
274+ /**
275+ * Checker animation duration.
276+ */
83277 checkerAnimDuration : number ;
84- }
278+ }
0 commit comments