@@ -14,27 +14,18 @@ declare module Fabrique {
14
14
focusOut : Phaser . Signal ;
15
15
constructor ( game : Phaser . Game , id : string , type ?: InputType , value ?: string ) ;
16
16
addKeyUpListener ( callback : ( ) => void ) : void ;
17
- /**
18
- * Captures the keyboard event on keydown, used to prevent it going from input field to sprite
19
- **/
20
17
blockKeyDownEvents ( ) : void ;
21
- /**
22
- * To prevent bubbling of keyboard event from input field to sprite
23
- **/
24
18
private preventKeyPropagation ( evt ) ;
25
- /**
26
- * Remove listener that captures keydown keyboard events
27
- **/
28
19
unblockKeyDownEvents ( ) : void ;
29
20
removeEventListener ( ) : void ;
30
21
destroy ( ) : void ;
31
22
setMax ( max : string , min ?: string ) : void ;
32
23
value : string ;
33
24
focus ( ) : void ;
34
25
blur ( ) : void ;
35
- hasSelection : boolean ;
36
- caretStart : number ;
37
- caretEnd : number ;
26
+ readonly hasSelection : boolean ;
27
+ readonly caretStart : number ;
28
+ readonly caretEnd : number ;
38
29
getCaretPosition ( ) : number ;
39
30
setCaretPosition ( pos : number ) : void ;
40
31
}
@@ -76,70 +67,22 @@ declare module Fabrique {
76
67
private windowScale ;
77
68
blockInput : boolean ;
78
69
constructor ( game : Phaser . Game , x : number , y : number , inputOptions ?: InputOptions ) ;
79
- /**
80
- * This is a generic input down handler for the game.
81
- * if the input object is clicked, we gain focus on it and create the dom element
82
- *
83
- * If there was focus on the element previously, but clicked outside of it, the element will loose focus
84
- * and no keyboard events will be registered anymore
85
- *
86
- * @param e Phaser.Pointer
87
- */
88
70
private checkDown ( e ) ;
89
- /**
90
- * Update function makes the cursor blink, it uses two private properties to make it toggle
91
- *
92
- * @returns {number }
93
- */
94
71
private blink ;
95
72
private cnt ;
96
73
update ( ) : number ;
97
- /**
98
- * Focus is lost on the input element, we disable the cursor and remove the hidden input element
99
- */
100
74
endFocus ( ) : void ;
101
- /**
102
- *
103
- */
104
75
startFocus ( ) : void ;
105
76
private keyUpProcessor ( ) ;
106
- /**
107
- * Update the text value in the box, and make sure the cursor is positioned correctly
108
- */
109
77
private updateText ( ) ;
110
- /**
111
- * Updates the position of the caret in the phaser input field
112
- */
113
78
private updateCursor ( ) ;
114
- /**
115
- * Fetches the carrot position from the dom element. This one changes when you use the keyboard to navigate the element
116
- *
117
- * @returns {number }
118
- */
119
79
private getCaretPosition ( ) ;
120
- /**
121
- * Set the caret when a click was made in the input field
122
- *
123
- * @param e
124
- */
125
80
private setCaretOnclick ( e ) ;
126
- /**
127
- * This checks if a select has been made, and if so highlight it with blue
128
- */
129
81
private updateSelection ( ) ;
130
82
private zoomIn ( ) ;
131
83
private zoomOut ( ) ;
132
- /**
133
- * Event fired when a key is pressed, it takes the value from the hidden input field and adds it as its own
134
- */
135
84
private keyListener ( evt ) ;
136
- /**
137
- * We overwrite the destroy method because we want to delete the (hidden) dom element when the inputField was removed
138
- */
139
85
destroy ( destroyChildren ?: boolean ) : void ;
140
- /**
141
- * Resets the text to an empty value
142
- */
143
86
resetText ( ) : void ;
144
87
setText ( text ?: string ) : void ;
145
88
}
@@ -185,10 +128,6 @@ declare module Fabrique {
185
128
static onKeyboardOpen : Phaser . Signal ;
186
129
static onKeyboardClose : Phaser . Signal ;
187
130
constructor ( game : Phaser . Game , parent : Phaser . PluginManager ) ;
188
- /**
189
- * Extends the GameObjectFactory prototype with the support of adding InputField. this allows us to add InputField methods to the game just like any other object:
190
- * game.add.InputField();
191
- */
192
131
private addInputFieldFactory ( ) ;
193
132
}
194
133
}
0 commit comments