File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,15 @@ if( typeof AFRAME != 'undefined '){
387387 instance . addEventListener ( 'window.onmaximize' , resize )
388388
389389 const focus = ( e ) => {
390+
391+ // calculate distance between thumb and indexfinger to detect pinch
392+ // which should prevent focus-event (annoying to have keyboard popping up during pinch)
393+ if ( e . detail ?. withEl ?. components [ 'hand-tracking-controls' ] ) {
394+ const hand = e . detail . withEl . components [ 'hand-tracking-controls' ]
395+ const thumb = hand . bones . find ( ( b ) => b . name == 'thumb-tip' )
396+ const diff = thumb . position . distanceTo ( hand . indexTipPosition )
397+ if ( diff < 0.02 ) return // pinching! don't trigger keyboard (focus)
398+ }
390399 this . el . emit ( 'focus' , e . detail )
391400 }
392401
You can’t perform that action at this time.
0 commit comments