diff --git a/index.html b/index.html index 3d663bf..46eba6e 100644 --- a/index.html +++ b/index.html @@ -203,6 +203,23 @@ function spreadItemsFromCollection( generatorName, offset=1, step=1/10, depth=-. shareLiveEvent('modified list', items) } +AFRAME.registerComponent('onemptypinch', { // changed from ondrop to be coherent with event name +// could support multi + events: { + emptypinch: function (e) { + let code = this.el.getAttribute('onemptypinch') + // if multi, should also look for onreleased__ not just onreleased + try { + console.log('emptypinch', e.detail.position) + eval( code ) // should be jxr too e.g if (txt.match(prefix)) interpretJXR(txt) + } catch (error) { + console.error(`Evaluation failed with ${error}`); + } + } + } +}) + + let page = "Wiki.VirtualRealityInterface"; // should do then only once graph loaded instead, should emit event let pageFromParam = AFRAME.utils.getUrlParameter('page') @@ -220,7 +237,7 @@ setTimeout( _ => { - + diff --git a/jxr-core.js b/jxr-core.js index 2c990c2..4ea28a2 100644 --- a/jxr-core.js +++ b/jxr-core.js @@ -213,6 +213,8 @@ AFRAME.registerComponent('pinchprimary', { // currently only 1 hand, the right o if (selectedElement) { selectedElements.push({element:selectedElement, timestamp:Date.now(), primary:true}) selectedElement.emit("picked") + } else { + AFRAME.scenes[0].emit('emptypinch', {position:event.detail.position, timestamp:Date.now() }) } // is it truly world position? See https://github.com/aframevr/aframe/issues/5182 // setFeedbackHUD( AFRAME.utils.coordinates.stringify( event.detail.position ) )