diff --git a/dist/xrfragment.aframe.all.js b/dist/xrfragment.aframe.all.js index 70cd61a..3e0f2d6 100644 --- a/dist/xrfragment.aframe.all.js +++ b/dist/xrfragment.aframe.all.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Tue Jun 25 01:51:16 PM UTC 2024 + * v0.5.1 generated at Wed Jun 26 11:16:30 AM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -2124,7 +2124,7 @@ xrf.navigator.init = () => { xrf.navigator.URI = xrfragment.URI.parse(document.location.href) window.addEventListener('popstate', function (event){ - if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) + if( xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) xrf.navigator.to( document.location.href.replace(/.*\?/,'') ) } }) @@ -2191,9 +2191,10 @@ xrf.navigator.reactifyHash = ( obj ) => { get(me,k) { return me[k] }, set(me,k,v){ me[k] = v - if( xrf.navigator.reactifyHash.enabled ){ + if( xrf.navigator.updateHash.active ){ xrf.navigator.to( "#" + this.toString(me) ) } + xrf.navigator.URI.fragment = this.toString(me) }, toString(me){ let parts = [] @@ -2204,7 +2205,6 @@ xrf.navigator.reactifyHash = ( obj ) => { } }) } -xrf.navigator.reactifyHash.enabled = true /** * * navigation, portals & mutations diff --git a/dist/xrfragment.aframe.js b/dist/xrfragment.aframe.js index cf2227d..440e805 100644 --- a/dist/xrfragment.aframe.js +++ b/dist/xrfragment.aframe.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Tue Jun 25 01:51:16 PM UTC 2024 + * v0.5.1 generated at Wed Jun 26 11:16:30 AM UTC 2024 * https://xrfragment.org * SPDX-License-Identifier: MPL-2.0 */ @@ -2122,7 +2122,7 @@ xrf.navigator.init = () => { xrf.navigator.URI = xrfragment.URI.parse(document.location.href) window.addEventListener('popstate', function (event){ - if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) + if( xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) xrf.navigator.to( document.location.href.replace(/.*\?/,'') ) } }) @@ -2189,9 +2189,10 @@ xrf.navigator.reactifyHash = ( obj ) => { get(me,k) { return me[k] }, set(me,k,v){ me[k] = v - if( xrf.navigator.reactifyHash.enabled ){ + if( xrf.navigator.updateHash.active ){ xrf.navigator.to( "#" + this.toString(me) ) } + xrf.navigator.URI.fragment = this.toString(me) }, toString(me){ let parts = [] @@ -2202,7 +2203,6 @@ xrf.navigator.reactifyHash = ( obj ) => { } }) } -xrf.navigator.reactifyHash.enabled = true /** * * navigation, portals & mutations diff --git a/src/3rd/js/plugin/frontend/frontend.js b/src/3rd/js/plugin/frontend/frontend.js index 03fe1dc..c7dbfcb 100644 --- a/src/3rd/js/plugin/frontend/frontend.js +++ b/src/3rd/js/plugin/frontend/frontend.js @@ -284,10 +284,11 @@ window.frontend = (opts) => new Proxy({ updateHashPosition(randomize){ const pos = xrf.frag.pos.get() - xrf.navigator.reactifyHash.enabled = false // prevent teleport + xrf.navigator.updateHash.active = false // prevent teleport xrf.navigator.URI.hash.pos = `${pos.x},${pos.y},${pos.z}` - xrf.navigator.reactifyHash.enabled = true - this.copyToClipboard( window.location.href ); + document.location.hash = `#${xrf.navigator.URI.fragment}` + xrf.navigator.updateHash.active = true + return document.location.href }, copyToClipboard(text){ @@ -305,11 +306,8 @@ window.frontend = (opts) => new Proxy({ if( network.meetingLink && !xrf.navigator.URI.hash.meet ){ xrf.navigator.URI.hash.meet = network.meetingLink } - if( !xrf.navigator.URI.hash.pos && (network.posName || network.pos) ){ - xrf.navigator.URI.hash.pos = network.posName || network.pos - }else frontend.updateHashPosition() - - let url = window.location.href + let url = frontend.updateHashPosition() + console.log(url) if( opts.linkonly ) return url this.copyToClipboard( url ) // End of *TODO* diff --git a/src/3rd/js/three/navigator.js b/src/3rd/js/three/navigator.js index bf1e84d..fdf8157 100644 --- a/src/3rd/js/three/navigator.js +++ b/src/3rd/js/three/navigator.js @@ -96,7 +96,7 @@ xrf.navigator.init = () => { xrf.navigator.URI = xrfragment.URI.parse(document.location.href) window.addEventListener('popstate', function (event){ - if( !xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) + if( xrf.navigator.updateHash.active ){ // ignore programmatic hash updates (causes infinite recursion) xrf.navigator.to( document.location.href.replace(/.*\?/,'') ) } }) @@ -163,9 +163,10 @@ xrf.navigator.reactifyHash = ( obj ) => { get(me,k) { return me[k] }, set(me,k,v){ me[k] = v - if( xrf.navigator.reactifyHash.enabled ){ + if( xrf.navigator.updateHash.active ){ xrf.navigator.to( "#" + this.toString(me) ) } + xrf.navigator.URI.fragment = this.toString(me) }, toString(me){ let parts = [] @@ -176,4 +177,3 @@ xrf.navigator.reactifyHash = ( obj ) => { } }) } -xrf.navigator.reactifyHash.enabled = true diff --git a/src/3rd/js/three/xrf/pos.js b/src/3rd/js/three/xrf/pos.js index 3a70e85..bc365d7 100644 --- a/src/3rd/js/three/xrf/pos.js +++ b/src/3rd/js/three/xrf/pos.js @@ -18,7 +18,6 @@ xrf.frag.pos = function(v, opts){ } if( xrf.debug ) console.log(`#pos.js: setting camera to position ${pos.x},${pos.y},${pos.z}`) - xrf.frag.pos.last = v.string // remember xrf.frag.pos.lastVector3 = camera.position.clone()