@@ -188,26 +188,27 @@ func (c *Context) Checkbox(label string, state *bool) bool {
188188 })
189189}
190190
191- func (c * Context ) textField (id controlID ) * textinput.Field {
191+ func (c * Context ) textInputTextField (id controlID ) * textinput.Field {
192192 if id == 0 {
193193 return nil
194194 }
195- if _ , ok := c .textFields [id ]; ! ok {
196- if c .textFields == nil {
197- c .textFields = make (map [controlID ]* textinput.Field )
195+ if _ , ok := c .textInputTextFields [id ]; ! ok {
196+ if c .textInputTextFields == nil {
197+ c .textInputTextFields = make (map [controlID ]* textinput.Field )
198198 }
199- c .textFields [id ] = & textinput.Field {}
199+ // TODO: Remove unused fields.
200+ c .textInputTextFields [id ] = & textinput.Field {}
200201 }
201- return c .textFields [id ]
202+ return c .textInputTextFields [id ]
202203}
203204
204- func (c * Context ) textBoxRaw (buf * string , id controlID , opt option ) bool {
205+ func (c * Context ) textFieldRaw (buf * string , id controlID , opt option ) bool {
205206 return c .control (id , opt | optionHoldFocus , func (bounds image.Rectangle ) bool {
206207 var res bool
207208
208209 if c .focus == id {
209210 // handle text input
210- f := c .textField (id )
211+ f := c .textInputTextField (id )
211212 f .Focus ()
212213 x := bounds .Min .X + c .style .padding + textWidth (* buf )
213214 y := bounds .Min .Y + lineHeight ()
@@ -236,7 +237,7 @@ func (c *Context) textBoxRaw(buf *string, id controlID, opt option) bool {
236237 }
237238 }
238239 } else {
239- f := c .textField (id )
240+ f := c .textInputTextField (id )
240241 if * buf != f .TextForRendering () {
241242 f .SetTextAndSelection (* buf , len (* buf ), len (* buf ))
242243 }
@@ -262,14 +263,14 @@ func (c *Context) textBoxRaw(buf *string, id controlID, opt option) bool {
262263 })
263264}
264265
265- func (c * Context ) numberTextBox (value * float64 , id controlID ) bool {
266+ func (c * Context ) numberTextField (value * float64 , id controlID ) bool {
266267 if inpututil .IsMouseButtonJustPressed (ebiten .MouseButtonLeft ) && ebiten .IsKeyPressed (ebiten .KeyShift ) &&
267268 c .hover == id {
268269 c .numberEdit = id
269270 c .numberEditBuf = fmt .Sprintf (realFmt , * value )
270271 }
271272 if c .numberEdit == id {
272- res := c .textBoxRaw (& c .numberEditBuf , id , 0 )
273+ res := c .textFieldRaw (& c .numberEditBuf , id , 0 )
273274 if res || c .focus != id {
274275 nval , err := strconv .ParseFloat (c .numberEditBuf , 32 )
275276 if err != nil {
@@ -283,9 +284,9 @@ func (c *Context) numberTextBox(value *float64, id controlID) bool {
283284 return false
284285}
285286
286- func (c * Context ) textBox (buf * string , opt option ) bool {
287+ func (c * Context ) textField (buf * string , opt option ) bool {
287288 id := c .idFromString (fmt .Sprintf ("%p" , buf ))
288- return c .textBoxRaw (buf , id , opt )
289+ return c .textFieldRaw (buf , id , opt )
289290}
290291
291292func formatNumber (v float64 , digits int ) string {
@@ -298,7 +299,7 @@ func (c *Context) slider(value *float64, low, high, step float64, digits int, op
298299 id := c .idFromString (fmt .Sprintf ("%p" , value ))
299300
300301 // handle text input mode
301- if c .numberTextBox (& v , id ) {
302+ if c .numberTextField (& v , id ) {
302303 return false
303304 }
304305
@@ -340,7 +341,7 @@ func (c *Context) number(value *float64, step float64, digits int, opt option) b
340341 last := * value
341342
342343 // handle text input mode
343- if c .numberTextBox (value , id ) {
344+ if c .numberTextField (value , id ) {
344345 return false
345346 }
346347
0 commit comments