allow empty xrf

This commit is contained in:
Leon van Kammen 2024-01-03 15:55:23 +00:00
parent 13f96e0506
commit 49cdf18472
7 changed files with 4797 additions and 345 deletions

View file

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Sat Dec 30 09:46:42 PM UTC 2023 * v0.5.1 generated at Wed Jan 3 03:55:09 PM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0 * SPDX-License-Identifier: MPL-2.0
*/ */
@ -2341,6 +2341,8 @@ xrf.addEventListener('t', (opts) => {
}) })
window.AFRAME.registerComponent('xrf', { window.AFRAME.registerComponent('xrf', {
schema: { schema: {
http: { type:'string'},
https: { type:'string'},
}, },
init: function () { init: function () {
if( !AFRAME.XRF ){ if( !AFRAME.XRF ){
@ -2350,8 +2352,7 @@ window.AFRAME.registerComponent('xrf', {
camera.setAttribute('xrf-fade','') camera.setAttribute('xrf-fade','')
AFRAME.fade = camera.components['xrf-fade'] AFRAME.fade = camera.components['xrf-fade']
let aScene = document.querySelector('a-scene') let aScene = AFRAME.scenes[0]
aScene.addEventListener('loaded', () => {
// enable XR fragments // enable XR fragments
let XRF = AFRAME.XRF = xrf.init({ let XRF = AFRAME.XRF = xrf.init({
@ -2444,18 +2445,23 @@ window.AFRAME.registerComponent('xrf', {
els.map( (el) => document.querySelector('a-scene').removeChild(el) ) els.map( (el) => document.querySelector('a-scene').removeChild(el) )
}) })
AFRAME.XRF.navigator.to(this.data) if( typeof this.data === 'string' || this.data.http || this.data.https ){
let url
if( typeof this.data === 'string' ) url = this.data
if( this.data.http ) url = `http:${this.data.http}`
if( this.data.https ) url = `https:${this.data.https}`
AFRAME.XRF.navigator.to( url )
.then( (model) => { .then( (model) => {
let gets = [ ...document.querySelectorAll('[xrf-get]') ] let gets = [ ...document.querySelectorAll('[xrf-get]') ]
gets.map( (g) => g.emit('update') ) gets.map( (g) => g.emit('update') )
}) })
}
aScene.emit('XRF',{}) aScene.emit('XRF',{})
// enable gaze-click on Mobile VR // enable gaze-click on Mobile VR
aScene.setAttribute('xrf-gaze','') aScene.setAttribute('xrf-gaze','')
})
} }
if( typeof this.data == "string" ){ if( typeof this.data == "string" ){

View file

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Sat Dec 30 09:46:41 PM UTC 2023 * v0.5.1 generated at Wed Jan 3 03:55:09 PM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0 * SPDX-License-Identifier: MPL-2.0
*/ */
@ -2339,6 +2339,8 @@ xrf.addEventListener('t', (opts) => {
}) })
window.AFRAME.registerComponent('xrf', { window.AFRAME.registerComponent('xrf', {
schema: { schema: {
http: { type:'string'},
https: { type:'string'},
}, },
init: function () { init: function () {
if( !AFRAME.XRF ){ if( !AFRAME.XRF ){
@ -2348,8 +2350,7 @@ window.AFRAME.registerComponent('xrf', {
camera.setAttribute('xrf-fade','') camera.setAttribute('xrf-fade','')
AFRAME.fade = camera.components['xrf-fade'] AFRAME.fade = camera.components['xrf-fade']
let aScene = document.querySelector('a-scene') let aScene = AFRAME.scenes[0]
aScene.addEventListener('loaded', () => {
// enable XR fragments // enable XR fragments
let XRF = AFRAME.XRF = xrf.init({ let XRF = AFRAME.XRF = xrf.init({
@ -2442,18 +2443,23 @@ window.AFRAME.registerComponent('xrf', {
els.map( (el) => document.querySelector('a-scene').removeChild(el) ) els.map( (el) => document.querySelector('a-scene').removeChild(el) )
}) })
AFRAME.XRF.navigator.to(this.data) if( typeof this.data === 'string' || this.data.http || this.data.https ){
let url
if( typeof this.data === 'string' ) url = this.data
if( this.data.http ) url = `http:${this.data.http}`
if( this.data.https ) url = `https:${this.data.https}`
AFRAME.XRF.navigator.to( url )
.then( (model) => { .then( (model) => {
let gets = [ ...document.querySelectorAll('[xrf-get]') ] let gets = [ ...document.querySelectorAll('[xrf-get]') ]
gets.map( (g) => g.emit('update') ) gets.map( (g) => g.emit('update') )
}) })
}
aScene.emit('XRF',{}) aScene.emit('XRF',{})
// enable gaze-click on Mobile VR // enable gaze-click on Mobile VR
aScene.setAttribute('xrf-gaze','') aScene.setAttribute('xrf-gaze','')
})
} }
if( typeof this.data == "string" ){ if( typeof this.data == "string" ){

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Sat Dec 30 09:46:42 PM UTC 2023 * v0.5.1 generated at Wed Jan 3 03:55:09 PM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0 * SPDX-License-Identifier: MPL-2.0
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* v0.5.1 generated at Sat Dec 30 09:46:42 PM UTC 2023 * v0.5.1 generated at Wed Jan 3 03:55:09 PM UTC 2024
* https://xrfragment.org * https://xrfragment.org
* SPDX-License-Identifier: MPL-2.0 * SPDX-License-Identifier: MPL-2.0
*/ */

View file

@ -30,15 +30,14 @@
<!-- --> <!-- -->
<!-- everything below is completely optional, but handy to add a quick menu / connectivity to your space --> <!-- everything below is completely optional, but handy to add a quick menu / connectivity to your space -->
<!-- --> <!-- -->
<script src="./../../../dist/aframe-blink-controls.min.js"></script> <!-- teleporting using controllers -->
<script src="./../../../dist/xrfragment.plugin.frontend.js"></script> <!-- menu + chat interface -->
<script src="./../../../dist/xrfragment.plugin.p2p.js"></script> <!-- serverless p2p connectivity -->
<script src="./../../../dist/xrfragment.plugin.matrix.js"></script> <!-- matrix connectivity -->
<script> <script>
$menu.logo = 'logo_file_or_url_here'
$menu.morelabel = '⚡' document.addEventListener('$menu:ready', (e) => {
let {$menu} = e.detail
// add your menubuttons: // add your menubuttons:
$menu.buttons = $menu.buttons.concat([`<a class="btn" aria-label="button" aria-title="menu button" aria-description="about menu" onclick="$menu.showAbout()">💁 about</a><br>`]) $menu.buttons = $menu.buttons.concat([
`<a class="btn" aria-label="button" aria-title="menu button" onclick="$menu.showAbout()"><i class="gg-info"></i>&nbsp;&nbsp;&nbsp;about</a><br>`
])
$menu.collapsed = false $menu.collapsed = false
$menu.showAbout = () => window.notify(` $menu.showAbout = () => window.notify(`
<h1>💁 Hi there!</h1> <h1>💁 Hi there!</h1>
@ -63,9 +62,12 @@
</a> </a>
<br><br> <br><br>
`,{timeout:false}) `,{timeout:false})
})
$menu.install(xrf)
</script> </script>
<script src="./../../../dist/aframe-blink-controls.min.js"></script> <!-- teleporting using controllers -->
<script src="./../../../dist/xrfragment.plugin.frontend.js"></script> <!-- menu + chat interface -->
<script src="./../../../dist/xrfragment.plugin.p2p.js"></script> <!-- serverless p2p connectivity -->
<script src="./../../../dist/xrfragment.plugin.matrix.js"></script> <!-- matrix connectivity -->
</body> </body>
</html> </html>

View file

@ -1,5 +1,7 @@
window.AFRAME.registerComponent('xrf', { window.AFRAME.registerComponent('xrf', {
schema: { schema: {
http: { type:'string'},
https: { type:'string'},
}, },
init: function () { init: function () {
if( !AFRAME.XRF ){ if( !AFRAME.XRF ){
@ -9,8 +11,7 @@ window.AFRAME.registerComponent('xrf', {
camera.setAttribute('xrf-fade','') camera.setAttribute('xrf-fade','')
AFRAME.fade = camera.components['xrf-fade'] AFRAME.fade = camera.components['xrf-fade']
let aScene = document.querySelector('a-scene') let aScene = AFRAME.scenes[0]
aScene.addEventListener('loaded', () => {
// enable XR fragments // enable XR fragments
let XRF = AFRAME.XRF = xrf.init({ let XRF = AFRAME.XRF = xrf.init({
@ -103,18 +104,23 @@ window.AFRAME.registerComponent('xrf', {
els.map( (el) => document.querySelector('a-scene').removeChild(el) ) els.map( (el) => document.querySelector('a-scene').removeChild(el) )
}) })
AFRAME.XRF.navigator.to(this.data) if( typeof this.data === 'string' || this.data.http || this.data.https ){
let url
if( typeof this.data === 'string' ) url = this.data
if( this.data.http ) url = `http:${this.data.http}`
if( this.data.https ) url = `https:${this.data.https}`
AFRAME.XRF.navigator.to( url )
.then( (model) => { .then( (model) => {
let gets = [ ...document.querySelectorAll('[xrf-get]') ] let gets = [ ...document.querySelectorAll('[xrf-get]') ]
gets.map( (g) => g.emit('update') ) gets.map( (g) => g.emit('update') )
}) })
}
aScene.emit('XRF',{}) aScene.emit('XRF',{})
// enable gaze-click on Mobile VR // enable gaze-click on Mobile VR
aScene.setAttribute('xrf-gaze','') aScene.setAttribute('xrf-gaze','')
})
} }
if( typeof this.data == "string" ){ if( typeof this.data == "string" ){