Skip to content

Commit f11832c

Browse files
committed
debugui: remove Widget
Let's revisit when widget APIs are settled.
1 parent b8ad11a commit f11832c

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

example/ui.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func (g *Game) testWindow(ctx *debugui.Context) {
130130
ctx.Text("Blue:")
131131
ctx.Slider(&g.bg[2], 0, 255, 1)
132132
})
133-
ctx.Widget(func(bounds image.Rectangle) debugui.EventHandler {
133+
ctx.GridCell(func(bounds image.Rectangle) {
134134
ctx.DrawWidget(func(screen *ebiten.Image) {
135135
scale := ctx.Scale()
136136
vector.DrawFilledRect(
@@ -149,7 +149,6 @@ func (g *Game) testWindow(ctx *debugui.Context) {
149149
op.SecondaryAlign = text.AlignCenter
150150
debugui.DrawText(screen, txt, op)
151151
})
152-
return nil
153152
})
154153
})
155154
ctx.Header("Number", true, func() {

widget.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,6 @@ func (c *Context) updateWidget(id WidgetID, bounds image.Rectangle, opt option)
8888
return
8989
}
9090

91-
func (c *Context) Widget(f func(bounds image.Rectangle) EventHandler) EventHandler {
92-
pc := caller()
93-
id := c.idFromCaller(pc)
94-
return c.wrapEventHandlerAndError(func() (EventHandler, error) {
95-
return c.widget(id, 0, func(bounds image.Rectangle, wasFocused bool) (EventHandler, error) {
96-
return f(bounds), nil
97-
})
98-
})
99-
}
100-
10191
func (c *Context) widget(id WidgetID, opt option, f func(bounds image.Rectangle, wasFocused bool) (EventHandler, error)) (EventHandler, error) {
10292
c.currentID = id
10393
r, err := c.layoutNext()

0 commit comments

Comments
 (0)