NikLever / XRGestures

Add touch gestures to a WebXR AR app without using dom-overlay
GNU General Public License v3.0
21 stars 3 forks source link

Tap not dispatching #3

Closed DouglasLapsley closed 2 years ago

DouglasLapsley commented 2 years ago

I think you need to add the following line to the onSelectEnd method?

if ( startToEnd < self.doubleClickLimit ){
    self.dispatchEvent( { type: 'tap', position: self.controller1.position, matrixWorld: self.controller1.matrixWorld }   ); //  ADD THIS LINE??
    self.type = "tap";
    data.taps++;
}else if ( startToEnd > self.pressMinimum ){
    self.dispatchEvent( { type: 'press', position: self.controller1.position, matrixWorld: self.controller1.matrixWorld }   );
    self.type = 'unknown';
}

Thanks.

DouglasLapsley commented 2 years ago

Actually it seems this isn't the fix, but the single tap isn't being dispatched. Nice bit of work though, thank you :)

DouglasLapsley commented 2 years ago

My bad. I didn't realise you have to include the update() function call in the three.js update loop. Works now.