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 1 year ago

DouglasLapsley commented 1 year 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 1 year 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 1 year ago

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