Remove rerendering from loader's responsibility
This commit is contained in:
parent
62f807b6fe
commit
c897c6d72e
1
main.go
1
main.go
|
@ -34,6 +34,7 @@ func main() {
|
|||
for i := 0; i < steps; i++ {
|
||||
l.UpdatePositions()
|
||||
page.loader.Inc()
|
||||
vecty.Rerender(page.loader)
|
||||
runtime.Gosched()
|
||||
}
|
||||
page.loaded = true
|
||||
|
|
|
@ -36,12 +36,10 @@ func NewLoader(steps int) *Loader {
|
|||
|
||||
func (l *Loader) Inc() {
|
||||
l.current++
|
||||
vecty.Rerender(l)
|
||||
}
|
||||
|
||||
// Progress reports loader's progress in percentage.
|
||||
func (l *Loader) Progress() float64 {
|
||||
fmt.Println("progress", 100*float64(l.current)/float64(l.steps))
|
||||
return 100 * float64(l.current) / float64(l.steps)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue