mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/ui: fix a potential out-of-range error
This commit is contained in:
parent
7f39b9c5b6
commit
16e49e0499
@ -51,11 +51,19 @@ var codeToMouseButton = map[int]MouseButton{
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) keyDown(code js.Value) {
|
||||
u.inputState.KeyPressed[jsKeyToID(code)] = true
|
||||
id := jsKeyToID(code)
|
||||
if id < 0 {
|
||||
return
|
||||
}
|
||||
u.inputState.KeyPressed[id] = true
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) keyUp(code js.Value) {
|
||||
u.inputState.KeyPressed[jsKeyToID(code)] = false
|
||||
id := jsKeyToID(code)
|
||||
if id < 0 {
|
||||
return
|
||||
}
|
||||
u.inputState.KeyPressed[id] = false
|
||||
}
|
||||
|
||||
func (u *userInterfaceImpl) mouseDown(code int) {
|
||||
|
Loading…
Reference in New Issue
Block a user