mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
input: Bug fix: keypress event were not fired
This change suspends to 'preventDefault' on keydown events. Now preventing navigation by pressing backspace is deprecated in Chrome. For other keys, it looks like keyup's preventDefault is enough to disable the browser default behavior.
This commit is contained in:
parent
d6e109555d
commit
a073f48faf
@ -325,7 +325,7 @@ func init() {
|
||||
canvas.Get("style").Set("outline", "none")
|
||||
|
||||
// Keyboard
|
||||
canvas.Call("addEventListener", "keydown", js.NewEventCallback(js.PreventDefault, input.OnKeyDown))
|
||||
canvas.Call("addEventListener", "keydown", js.NewEventCallback(0, input.OnKeyDown))
|
||||
canvas.Call("addEventListener", "keypress", js.NewEventCallback(js.PreventDefault, input.OnKeyPress))
|
||||
canvas.Call("addEventListener", "keyup", js.NewEventCallback(js.PreventDefault, input.OnKeyUp))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user