whispervis/keys.go

19 lines
313 B
Go
Raw Normal View History

2018-09-05 16:53:09 +03:00
package main
import (
"github.com/gopherjs/vecty"
)
2018-09-05 16:53:09 +03:00
// KeyListener implements listener for keydown events.
func (p *Page) KeyListener(e *vecty.Event) {
key := e.Get("key").String()
switch key {
case "p":
2018-09-17 22:11:04 +03:00
p.webgl.ToggleAutoRotation()
2018-10-12 22:34:30 +02:00
case "o":
p.webgl.ToggleWobbling()
case "]":
p.ApplyForces()
2018-09-05 16:53:09 +03:00
}
}