aframe icon indicating copy to clipboard operation
aframe copied to clipboard

mousedown event fires twice

Open dirkk0 opened this issue 4 years ago • 7 comments

Description: On Oculus Quest, the mousedown event seems to fire twice.

  • A-Frame Version: 1.0.4
  • Platform / Device: Oculus Quest
  • Reproducible Code Snippet or URL: https://curious-electric.com//w/experiments/aframe/minimal-quest-event-bug/

Possibly related to #4494 and/or #3297.

dirkk0 avatar Feb 24 '20 20:02 dirkk0

Better to use glitch to be able to look and modify code and suggest solutions. https://glitch.com/~aframe Also adding all the info in the issue will make for an easier discussion.

dmarcos avatar Feb 25 '20 17:02 dmarcos

Of course you are right on both points, sorry for that.

Description: On Oculus Quest, the mousedown event seems to fire twice. I think this is somehow related to https://github.com/aframevr/aframe/issues/3297 and https://github.com/aframevr/aframe/issues/4141

Before entering VR the button cube changes the state, but after that it doesn't since the function is executed twice.

A workaround seems to be to delay another execution like so:

if (this.waiting) {
  console.log("sorry, no ...");
  return;
}
          this.waiting = true;
setTimeout(() => {
  this.waiting = false;
  console.log("reset ...");
}, 100);

Glitch is here: https://husky-insidious-brother.glitch.me/

dirkk0 avatar Feb 26 '20 09:02 dirkk0

The reason mousedown fires twice is that both generic-tracked-controller-controls and oculus-touch-controls emit events at the same time.

I have fixed some controller issues using A-Frame with Oculus Quest. I put A-Frame with the workaround in the following URL. If possible, could you make sure your issue is fixed? @dirkk0 https://binzume.github.io/aframe/dist/aframe-master.min.js

@dmarcos The cause is clear, but I'm not sure if the fix makes sense just by looking at the code... Are you worried about the above commit?

binzume avatar May 02 '20 04:05 binzume

@binzume Thanks for investigating. Can you open a PR?

dmarcos avatar May 02 '20 07:05 dmarcos

@binzume Yes, I can confirm that this works! Thanks!

dirkk0 avatar May 03 '20 15:05 dirkk0

I am encountering this issue as well.

NomisGnos avatar Aug 26 '20 19:08 NomisGnos

Im having the same problem on angular 15 and aframe 1.4.2 with the (click) event of angular but the workaround works @dirkk0

Roxcsas avatar May 16 '23 12:05 Roxcsas