cuianthony / andor-game

Web version of the Legends of Andor boardgame, built with Phaser3
0 stars 0 forks source link

Camera keys input not registered in EditTexts #36

Closed cuianthony closed 4 years ago

cuianthony commented 4 years ago

I suspect the issue wasn't actually that the keys were still bound. Was able to verify that key presses were still getting captured in the LoadGame scene, they just weren't propagating to the EditText. How the EditText works is a bit of a mystery because it comes from the UI plugin, but there may be some problems with how it takes input and how input keys were assigned in the game scene. As a workaround, in the game scene, directly assign listeners to key events instead of creating key objects. Unfortunately, this makes panning the camera much less smooth and responsive than the update loop approach. Other option would be to replace the EditText with some simpler, custom built text input

cuianthony commented 4 years ago

https://github.com/rexrainbow/phaser3-rex-notes/issues/107 issue on rex github

cuianthony commented 4 years ago

Solved by rex Solution is to toggle preventDefault on the added keys to false. It is set to true by default, which prevents the inputs from propagating to the native DOM. Thus, it must be false for the EditText to receive inputs, as EditText is built from the DOM text field element