aboutsummaryrefslogtreecommitdiffstats
path: root/gui/widget/widget.go
diff options
context:
space:
mode:
Diffstat (limited to 'gui/widget/widget.go')
-rw-r--r--gui/widget/widget.go30
1 files changed, 0 insertions, 30 deletions
diff --git a/gui/widget/widget.go b/gui/widget/widget.go
index 3bbfd1b..84e7175 100644
--- a/gui/widget/widget.go
+++ b/gui/widget/widget.go
@@ -1,7 +1,6 @@
package widget
import (
- "fmt"
"sync"
xdraw "golang.org/x/image/draw"
@@ -42,32 +41,3 @@ func Label(str string, r image.Rectangle, env gui.Env, wg *sync.WaitGroup) {
}
}
}
-
-func Output(val <-chan float64, r image.Rectangle, env gui.Env, wg *sync.WaitGroup) {
- defer wg.Done()
- defer close(env.Draw())
-
- var v float64 = 0.0
- env.Draw() <- outputDraw(v, r)
-Loop:
- for {
- select {
- case v = <-val:
- env.Draw() <- outputDraw(v, r)
- case event, ok := <-env.Events():
- if !ok { // channel closed
- break Loop
- }
- if event, ok := event.(win.WiFocus); ok && event.Focused {
- env.Draw() <- outputDraw(v, r)
- }
- }
- }
-}
-
-func outputDraw(v float64, r image.Rectangle) func(draw.Image) image.Rectangle {
- return func(drw draw.Image) image.Rectangle {
- text.Draw([]byte(fmt.Sprintf("%.3f", v)), drw, r, BLACK, WHITE)
- return r
- }
-}