Open javipagan opened 4 years ago
Yes, you are alright, the documentation should help more. Meanwhile:
You have the superkeyboardinput
event. So:
<script>
AFRAME.registerComponent('my_keyboard_controller', {
init: function(){
this.el.addEventListener('superkeyboardinput', function(event){
alert(event.value); // the text
});
}
});
</script>
...
<a-entity id="keyboard" super-keyboard my_keyboard-controller></a-entity>
sorry, I'm typing without trying, but this is how it should look like 🤞
I have a semi-functional one up in my app, and am trying to get the input out of it. I tried just adding
window.addEventListener('superkeyboardchange', () => {
console.log(arguments)
})
and got nothing... same for input
and dismiss
. :/ will keep digging.
for the record,
window.addEventListener('superkeyboardchange', function(event){
console.log(event.detail.value); // the text
});
works in the demo to get each keypress (and 'input' on enter, and I presume 'dismiss' on exit as in docs).
But those events are not firing for the keyboard when in my app... :(
looking through the source I get downloaded to my site when I use the source recommended in the readme, I see that the only possible 'emit' values are 'keyboard-accepted' and 'keyboard-dismiss', which do not line up with what's in the docs, and do not give me the values input. Not sure if I have an older version or newer version, will try just downloading the dist file itself.
Yup, that fixed it. Problem is following the README.
README is using v 1.0, latest in dist is 2.1. will pull request readme to update.
Putting 2.1 makes it even worse for me, with this when I click on keyboards I don't even see input value now; did you find this problem?
I found the problem: I used hand-controls and it works only with laser-controls.
I also can't work this out, seems like some functional documentation would really help out here