prevent conflating pinch vs focus on terminal
This commit is contained in:
parent
6a4342f1d9
commit
834f5c9b22
1 changed files with 9 additions and 0 deletions
|
|
@ -387,6 +387,15 @@ if( typeof AFRAME != 'undefined '){
|
|||
instance.addEventListener('window.onmaximize', resize )
|
||||
|
||||
const focus = (e) => {
|
||||
|
||||
// calculate distance between thumb and indexfinger to detect pinch
|
||||
// which should prevent focus-event (annoying to have keyboard popping up during pinch)
|
||||
if( e.detail?.withEl?.components['hand-tracking-controls'] ){
|
||||
const hand = e.detail.withEl.components['hand-tracking-controls']
|
||||
const thumb = hand.bones.find( (b) => b.name == 'thumb-tip' )
|
||||
const diff = thumb.position.distanceTo(hand.indexTipPosition)
|
||||
if( diff < 0.02) return // pinching! don't trigger keyboard (focus)
|
||||
}
|
||||
this.el.emit('focus',e.detail)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue