mirror of
https://github.com/vsariola/sointu.git
synced 2026-02-23 08:33:17 -05:00
drafting
This commit is contained in:
parent
179ebb7cc3
commit
fcb9a06249
@ -2,6 +2,7 @@ package gioui
|
||||
|
||||
import (
|
||||
"math"
|
||||
"strconv"
|
||||
|
||||
"gioui.org/layout"
|
||||
"gioui.org/unit"
|
||||
@ -21,7 +22,6 @@ type (
|
||||
Theme *Theme
|
||||
Model *tracker.ScopeModel
|
||||
State *OscilloscopeState
|
||||
Style *PlotStyle
|
||||
}
|
||||
)
|
||||
|
||||
@ -40,7 +40,6 @@ func Scope(th *Theme, m *tracker.ScopeModel, st *OscilloscopeState) Oscilloscope
|
||||
Theme: th,
|
||||
Model: m,
|
||||
State: st,
|
||||
Style: &th.Oscilloscope,
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,12 +79,12 @@ func (s *Oscilloscope) Layout(gtx C) D {
|
||||
a := max(int(math.Ceil(float64(r.a*float32(l)))), 0)
|
||||
b := min(int(math.Floor(float64(r.b*float32(l)))), l)
|
||||
for i := a; i <= b; i++ {
|
||||
yield(float32(i)/float32(l), "")
|
||||
yield(float32(i)/float32(l), strconv.Itoa(i))
|
||||
}
|
||||
}
|
||||
yticks := func(r plotRange, yield func(pos float32, label string)) {
|
||||
yield(-1, "1")
|
||||
yield(1, "-1")
|
||||
yield(-1, "")
|
||||
yield(1, "")
|
||||
}
|
||||
|
||||
return s.State.plot.Layout(gtx, data, xticks, yticks, cx, 2)
|
||||
|
||||
Reference in New Issue
Block a user