added onemptypinch

core-vs-extras
Fabien Benetou 8 months ago
parent ffc8494062
commit 0421cf3099
  1. 19
      index.html
  2. 2
      jxr-core.js

@ -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( _ => {
</a>
</div>
<a-scene startfunctions >
<a-scene startfunctions onemptypinch="console.log('empty')">
<a-gltf-model hide-on-enter-ar="" id="environment" src="../content/CubeRoom.glb" rotation="0 -90 0" position="0 0 1" scale="" ></a-gltf-model>
<!-- Cube Room by Anonymous [CC-BY] via Poly Pizza -->

@ -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 ) )

Loading…
Cancel
Save