uidriver/js: Refactoring

This commit is contained in:
Hajime Hoshi 2020-12-20 18:19:58 +09:00
parent 2e2ee2595b
commit 8003000976

View File

@ -373,7 +373,7 @@ func (i *Input) updateFromEvent(e js.Value) {
i.wheelX = -e.Get("deltaX").Float() i.wheelX = -e.Get("deltaX").Float()
i.wheelY = -e.Get("deltaY").Float() i.wheelY = -e.Get("deltaY").Float()
case jsutil.Equal(t, stringTouchstart) || jsutil.Equal(t, stringTouchend) || jsutil.Equal(t, stringTouchmove): case jsutil.Equal(t, stringTouchstart) || jsutil.Equal(t, stringTouchend) || jsutil.Equal(t, stringTouchmove):
i.updateTouches(e) i.updateTouchesFromEvent(e)
} }
} }
@ -382,7 +382,7 @@ func (i *Input) setMouseCursorFromEvent(e js.Value) {
i.setMouseCursor(x, y) i.setMouseCursor(x, y)
} }
func (i *Input) updateTouches(e js.Value) { func (i *Input) updateTouchesFromEvent(e js.Value) {
j := e.Get("targetTouches") j := e.Get("targetTouches")
ts := map[driver.TouchID]pos{} ts := map[driver.TouchID]pos{}
for i := 0; i < j.Length(); i++ { for i := 0; i < j.Length(); i++ {