diff --git a/example/aframe/sandbox/index.html b/example/aframe/sandbox/index.html index 3135b0f..4a1b61d 100644 --- a/example/aframe/sandbox/index.html +++ b/example/aframe/sandbox/index.html @@ -21,7 +21,7 @@ ➕ clone project 📺 embed - ⬇️ model + ⬇️ model @@ -66,6 +66,7 @@ const isExtern = url[0] != '#' const notIsHome = url != $('#home').getAttribute("xrf") const promise = e.promise() // promisify event + document.querySelector('#model').setAttribute('href',url.replace(/.*\?/,'') ) if( !renderer.xr.isPresenting ){ if( isExtern && notIsHome ){ if( !confirm("teleport to "+url+" ?") ) return promise.reject('teleport rejected') diff --git a/example/threejs/sandbox/index.html b/example/threejs/sandbox/index.html index 74782a9..c6fb178 100644 --- a/example/threejs/sandbox/index.html +++ b/example/threejs/sandbox/index.html @@ -15,7 +15,7 @@ ➕ clone project 📺 embed - ⬇️ model + ⬇️ model @@ -126,7 +126,19 @@ window.XRF = XRF // expose to form let file = document.location.search.length > 2 ? document.location.search.substr(1) + document.location.hash : 'example.gltf#pos=1,0,4&rot=0,-30,0' - $('#model').setAttribute("href","./../../asset/"+file) + + // optional decoration of href event + XRF.addEventListener('href',(e) => { + if( e.click ){ + const { mesh, model, camera, scene, renderer, THREE} = e.XRF + const url = e.xrf.string + const isExtern = url[0] != '#' + const promise = e.promise() // promisify event + document.querySelector('#model').setAttribute('href',url.replace(/.*\?/,'') ) + promise.resolve() + } + }) + XRF.navigator.to( file )