mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
Bug fix: onkeydown function should return false to prevent browser shortcuts
This commit is contained in:
parent
ba5f613f44
commit
f78c79a5dd
@ -109,21 +109,25 @@ func init() {
|
|||||||
canvas.Call("setAttribute", "tabindex", 1)
|
canvas.Call("setAttribute", "tabindex", 1)
|
||||||
canvas.Get("style").Set("outline", "none")
|
canvas.Get("style").Set("outline", "none")
|
||||||
|
|
||||||
canvas.Set("onkeydown", func(e js.Object) {
|
canvas.Set("onkeydown", func(e js.Object) bool {
|
||||||
code := e.Get("keyCode").Int()
|
code := e.Get("keyCode").Int()
|
||||||
currentInput.keyDown(code)
|
currentInput.keyDown(code)
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
canvas.Set("onkeyup", func(e js.Object) {
|
canvas.Set("onkeyup", func(e js.Object) bool {
|
||||||
code := e.Get("keyCode").Int()
|
code := e.Get("keyCode").Int()
|
||||||
currentInput.keyUp(code)
|
currentInput.keyUp(code)
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
canvas.Set("onmousedown", func(e js.Object) {
|
canvas.Set("onmousedown", func(e js.Object) bool {
|
||||||
button := e.Get("button").Int()
|
button := e.Get("button").Int()
|
||||||
currentInput.mouseDown(button)
|
currentInput.mouseDown(button)
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
canvas.Set("onmouseup", func(e js.Object) {
|
canvas.Set("onmouseup", func(e js.Object) bool {
|
||||||
button := e.Get("button").Int()
|
button := e.Get("button").Int()
|
||||||
currentInput.mouseUp(button)
|
currentInput.mouseUp(button)
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
canvas.Set("oncontextmenu", func(e js.Object) bool {
|
canvas.Set("oncontextmenu", func(e js.Object) bool {
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user