Remove rerendering from loader's responsibility

This commit is contained in:
Ivan Danyliuk 2018-09-06 15:48:34 +03:00
parent 62f807b6fe
commit c897c6d72e
No known key found for this signature in database
GPG Key ID: 97ED33CE024E1DBF
2 changed files with 1 additions and 2 deletions

View File

@ -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

View File

@ -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)
}