mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
exp/textinput: bug fix: don't send events on Enter on desktop browsers
Apparently sending an event on pressing Enter on desktops could sometimes duplicate texts. Closes #3041
This commit is contained in:
parent
af29b7194d
commit
cde4c4fd2e
@ -78,7 +78,7 @@ func (t *textInput) init() {
|
|||||||
if e.Get("code").String() == "Tab" {
|
if e.Get("code").String() == "Tab" {
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
}
|
}
|
||||||
if e.Get("code").String() == "Enter" || e.Get("key").String() == "Enter" {
|
if ui.IsVirtualKeyboard() && (e.Get("code").String() == "Enter" || e.Get("key").String() == "Enter") {
|
||||||
// Ignore Enter key to avoid ebiten.IsKeyPressed(ebiten.KeyEnter) unexpectedly becomes true.
|
// Ignore Enter key to avoid ebiten.IsKeyPressed(ebiten.KeyEnter) unexpectedly becomes true.
|
||||||
e.Call("preventDefault")
|
e.Call("preventDefault")
|
||||||
ui.Get().UpdateInputFromEvent(e)
|
ui.Get().UpdateInputFromEvent(e)
|
||||||
|
Loading…
Reference in New Issue
Block a user