javascriptaframe

Why do A-frame objects trigger click events twice and how can I fix it?


When I want to add a click event to an A-frame object it always happens twice.

I tried adding javascript to limiting the amount of clicks. the expected result is only 1 activation of the event per click.

in the code here you can see it happen if u click on the english/dutch button (I put console logs to show it in the console) my goal here was to be able to toggle the buttons that appear on the side after clicking on english or dutch.


Solution

  • You have two cursor components. One attached to the scene, the other to the camera.

    Despite having different whitelists (which i guess is a bug, and maybe should end up in the issues), they are causing the double click events on your elements.