@@ -55,7 +55,7 @@ func (c *Context) mouseOver(bounds image.Rectangle) bool {
5555}
5656
5757func (c * Context ) updateControl (id controlID , bounds image.Rectangle , opt option ) (wasFocused bool ) {
58- if id == 0 {
58+ if id == emptyControlID {
5959 return false
6060 }
6161
@@ -73,11 +73,11 @@ func (c *Context) updateControl(id controlID, bounds image.Rectangle, opt option
7373
7474 if c .focus == id {
7575 if inpututil .IsMouseButtonJustPressed (ebiten .MouseButtonLeft ) && ! mouseover {
76- c .setFocus (0 )
76+ c .setFocus (emptyControlID )
7777 wasFocused = true
7878 }
7979 if ! ebiten .IsMouseButtonPressed (ebiten .MouseButtonLeft ) && (^ opt & optionHoldFocus ) != 0 {
80- c .setFocus (0 )
80+ c .setFocus (emptyControlID )
8181 wasFocused = true
8282 }
8383 }
@@ -86,7 +86,7 @@ func (c *Context) updateControl(id controlID, bounds image.Rectangle, opt option
8686 if inpututil .IsMouseButtonJustPressed (ebiten .MouseButtonLeft ) {
8787 c .setFocus (id )
8888 } else if ! mouseover {
89- c .hover = 0
89+ c .hover = emptyControlID
9090 }
9191 }
9292
@@ -129,7 +129,7 @@ func (c *Context) Text(text string) {
129129 var endIdx , p int
130130 c .SetGridLayout ([]int {- 1 }, []int {lineHeight ()})
131131 for endIdx < len (text ) {
132- if _ , err := c .control (0 , 0 , func (bounds image.Rectangle , wasFocused bool ) (bool , error ) {
132+ if _ , err := c .control (emptyControlID , 0 , func (bounds image.Rectangle , wasFocused bool ) (bool , error ) {
133133 w := 0
134134 endIdx = p
135135 startIdx := endIdx
@@ -180,7 +180,7 @@ func (c *Context) button(label string, opt option, callerPC uintptr) (controlID,
180180 return res , nil
181181 })
182182 if err != nil {
183- return 0 , false , err
183+ return emptyControlID , false , err
184184 }
185185 return id , res , nil
186186}
@@ -484,5 +484,5 @@ func (c *Context) isCapturingInput() bool {
484484 return false
485485 }
486486
487- return c .hoverRoot != nil || c .focus != 0
487+ return c .hoverRoot != nil || c .focus != emptyControlID
488488}
0 commit comments