chore(v2): vendor dependencies for offline/China builds
go mod vendor pins onnxruntime_go v1.12.1, Gio and the rest into v2/vendor so go run/build work without hitting proxy.golang.org (blocked/slow in China). Verified: CGO_ENABLED=1 go build -mod=vendor ./internal/spike and GOOS=windows go build -mod=vendor ./internal/ui both pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
package widget
|
||||
|
||||
import (
|
||||
"gioui.org/io/semantic"
|
||||
"gioui.org/layout"
|
||||
)
|
||||
|
||||
type Bool struct {
|
||||
Value bool
|
||||
|
||||
clk Clickable
|
||||
}
|
||||
|
||||
// Update the widget state and report whether Value was changed.
|
||||
func (b *Bool) Update(gtx layout.Context) bool {
|
||||
changed := false
|
||||
for b.clk.clicked(b, gtx) {
|
||||
b.Value = !b.Value
|
||||
changed = true
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
// Hovered reports whether pointer is over the element.
|
||||
func (b *Bool) Hovered() bool {
|
||||
return b.clk.Hovered()
|
||||
}
|
||||
|
||||
// Pressed reports whether pointer is pressing the element.
|
||||
func (b *Bool) Pressed() bool {
|
||||
return b.clk.Pressed()
|
||||
}
|
||||
|
||||
func (b *Bool) History() []Press {
|
||||
return b.clk.History()
|
||||
}
|
||||
|
||||
func (b *Bool) Layout(gtx layout.Context, w layout.Widget) layout.Dimensions {
|
||||
b.Update(gtx)
|
||||
dims := b.clk.layout(b, gtx, func(gtx layout.Context) layout.Dimensions {
|
||||
semantic.SelectedOp(b.Value).Add(gtx.Ops)
|
||||
semantic.EnabledOp(gtx.Enabled()).Add(gtx.Ops)
|
||||
return w(gtx)
|
||||
})
|
||||
return dims
|
||||
}
|
||||
Reference in New Issue
Block a user