mirror of
https://github.com/status-im/whispervis.git
synced 2025-02-08 03:15:09 +00:00
24 lines
436 B
Go
24 lines
436 B
Go
package main
|
|
|
|
import (
|
|
"github.com/gopherjs/vecty"
|
|
)
|
|
|
|
// KeyListener implements listener for keydown events.
|
|
func (p *Page) KeyListener(e *vecty.Event) {
|
|
p.webgl.rt.EnableRendering()
|
|
key := e.Get("key").String()
|
|
switch key {
|
|
case "p":
|
|
p.webgl.ToggleAutoRotation()
|
|
case "o":
|
|
p.webgl.ToggleWobbling()
|
|
case "f":
|
|
p.ApplyForces()
|
|
case "]":
|
|
p.simulationWidget.StepForward()
|
|
case "[":
|
|
p.simulationWidget.StepBackward()
|
|
}
|
|
}
|