minor bugfixes due to new release
This commit is contained in:
parent
2f867ab93d
commit
7f8ffca589
|
@ -105,7 +105,7 @@ chatComponent = {
|
|||
br.classList.add.apply(br.classList, opts.class)
|
||||
div.classList.add.apply(div.classList, opts.class.concat(["envelope"]))
|
||||
}
|
||||
if( msg.className.match(/(info|guide|ui)/) || !opts.from ){
|
||||
if( !msg.className.match(/(info|guide|ui)/) && !opts.from ){
|
||||
let frag = xrf.URI.parse(document.location.hash).XRF
|
||||
opts.from = 'you'
|
||||
if( frag.pos ) opts.pos = frag.pos.string
|
||||
|
@ -284,7 +284,8 @@ chatComponent.css = `
|
|||
cursor:grabbing;
|
||||
border: 1px solid #0002;
|
||||
}
|
||||
#messages .msg *{
|
||||
#messages .msg *,
|
||||
#messages .user *{
|
||||
pointer-events:all;
|
||||
-webkit-user-select:text;
|
||||
-moz-user-select:-moz-text;
|
||||
|
|
|
@ -249,7 +249,9 @@ connectionsComponent = {
|
|||
set(data,k,v){
|
||||
data[k] = v
|
||||
switch( k ){
|
||||
case "visible": el.style.display = v ? '' : 'none'; break;
|
||||
case "visible": el.style.display = v ? '' : 'none';
|
||||
if( !v && el.parentNode && el.parentNode.parentNode ) el.parentNode.parentNode.remove()
|
||||
break;
|
||||
case "webcam": $webcam.innerHTML = `<option>${data[k].map((p)=>p.profile.name).join('</option><option>')}</option>`; break;
|
||||
case "chatnetwork": $chatnetwork.innerHTML = `<option>${data[k].map((p)=>p.profile.name).join('</option><option>')}</option>`; break;
|
||||
case "scene": $scene.innerHTML = `<option>${data[k].map((p)=>p.profile.name).join('</option><option>')}</option>`; break;
|
||||
|
|
|
@ -95,7 +95,8 @@ window.frontend = (opts) => new Proxy({
|
|||
: "use WASD-keys and mouse-drag to move around"
|
||||
window.notify(instructions,{timeout:false})
|
||||
xrf.addEventListener('navigate', (opts) => {
|
||||
window.notify('<b class="badge">teleporting</b> to <b>'+opts.url+"</b><br><br>use back/forward browserbutton to undo")
|
||||
let pos = opts.url.replace( document.location.href.replace(/#.*/,''), '')
|
||||
window.notify('<b class="badge">teleporting</b> to <b>'+pos+"</b><br><br>use back/forward browserbutton to undo")
|
||||
}) // close dialogs when url changes
|
||||
},2000 )
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ xrf.parseModel = function(model,url){
|
|||
let file = xrf.getFile(url)
|
||||
model.file = file
|
||||
model.isXRF = true
|
||||
model.scene.isXRFRoot = true
|
||||
model.scene.traverse( (n) => n.isXRF = true ) // mark for deletion during reset()
|
||||
|
||||
xrf.emit('parseModel',{model,url,file})
|
||||
|
|
|
@ -13,10 +13,12 @@ xrf.navigator.to = (url,flags,loader,data) => {
|
|||
|
||||
let URI = xrfragment.URI.toAbsolute( xrf.navigator.URI, url )
|
||||
URI.hash = xrf.navigator.reactifyHash(URI.hash)
|
||||
let fileChange = URI.URN + URI.file != xrf.navigator.URI.URN + xrf.navigator.URI.file
|
||||
let external = URI.URN != document.location.origin + document.location.pathname
|
||||
let hasPos = URI.hash.pos
|
||||
let hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"")
|
||||
// decorate with extra state
|
||||
URI.fileChange = URI.file && URI.URN + URI.file != xrf.navigator.URI.URN + xrf.navigator.URI.file
|
||||
URI.external = URI.file && URI.URN != document.location.origin + document.location.pathname
|
||||
URI.hasPos = URI.hash.pos ? true : false
|
||||
URI.duplicatePos = URI.source == xrf.navigator.URI.source && URI.hasPos
|
||||
URI.hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"")
|
||||
let hashbus = xrf.hashbus
|
||||
xrf.navigator.URI = URI
|
||||
let {directory,file,fragment,fileExt} = URI;
|
||||
|
@ -40,22 +42,25 @@ xrf.navigator.to = (url,flags,loader,data) => {
|
|||
loader = loader || new Loader().setPath( URI.URN )
|
||||
}
|
||||
|
||||
if( !URI.fragment && !URI.file && !URI.fileExt ) return resolve(xrf.model) // nothing we can do here
|
||||
|
||||
if( xrf.model && !fileChange && hashChange && !hasPos ){
|
||||
if( URI.duplicatePos || (!URI.fragment && !URI.file && !URI.fileExt) ){
|
||||
return resolve(xrf.model) // nothing we can do here
|
||||
}
|
||||
|
||||
if( xrf.model && !URI.fileChange && URI.hashChange && !URI.hasPos ){
|
||||
evalFragment()
|
||||
return resolve(xrf.model) // positional navigation
|
||||
return resolve(xrf.model) // eval non-positional fragments (no loader needed)
|
||||
}
|
||||
|
||||
xrf
|
||||
.emit('navigateLoading', {url,loader,data})
|
||||
.then( () => {
|
||||
if( (!fileChange || !file) && hashChange && hasPos ){ // we're already loaded
|
||||
if( (!URI.fileChange || !file) && URI.hashChange && URI.hasPos ){ // we're already loaded
|
||||
evalFragment()
|
||||
xrf.emit('navigateLoaded',{url})
|
||||
return resolve(xrf.model)
|
||||
}
|
||||
|
||||
|
||||
// clear xrf objects from scene
|
||||
if( xrf.model && xrf.model.scene ) xrf.model.scene.visible = false
|
||||
xrf.reset()
|
||||
|
@ -67,11 +72,6 @@ xrf.navigator.to = (url,flags,loader,data) => {
|
|||
const onLoad = (model) => {
|
||||
|
||||
model.file = URI.file
|
||||
// only change url when loading *another* file
|
||||
if( xrf.model ){
|
||||
xrf.navigator.pushState( external ? URI.URN + URI.file : URI.file, fragment )
|
||||
}
|
||||
//if( xrf.model ) xrf.navigator.pushState( `${ document.location.pathname != URI.directory ? URI.directory: ''}${URI.file}`, fragment )
|
||||
xrf.model = model
|
||||
|
||||
if( !model.isXRF ) xrf.parseModel(model,url.replace(directory,"")) // this marks the model as an XRF model
|
||||
|
@ -86,12 +86,17 @@ xrf.navigator.to = (url,flags,loader,data) => {
|
|||
model.scene.traverse( (mesh) => xrf.parseModel.metadataInMesh(mesh,model) )
|
||||
}
|
||||
// spec: 1. execute the default predefined view '#' (if exist) (https://xrfragment.org/#predefined_view)
|
||||
xrf.frag.defaultPredefinedViews({model,scene:model.scene})
|
||||
const defaultFragment = xrf.frag.defaultPredefinedViews({model,scene:model.scene})
|
||||
// spec: predefined view(s) & objects-of-interest-in-XRWG from URI (https://xrfragment.org/#predefined_view)
|
||||
let frag = xrf.hashbus.pub( url, model) // and eval URI XR fragments
|
||||
|
||||
|
||||
xrf.add( model.scene )
|
||||
if( fragment ) xrf.navigator.updateHash(fragment)
|
||||
|
||||
// only change url when loading *another* file
|
||||
fragment = fragment || defaultFragment || ''
|
||||
xrf.navigator.pushState( URI.external ? URI.URN + URI.file : URI.file, fragment.replace(/^#/,'') )
|
||||
//if( fragment ) xrf.navigator.updateHash(fragment)
|
||||
|
||||
xrf.emit('navigateLoaded',{url,model})
|
||||
resolve(model)
|
||||
}
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
|
||||
xrf.frag.defaultPredefinedViews = (opts) => {
|
||||
let {scene,model} = opts;
|
||||
let defaultFragment;
|
||||
scene.traverse( (n) => {
|
||||
if( n.userData && n.userData['#'] ){
|
||||
if( !n.parent && !document.location.hash ){
|
||||
xrf.navigator.to( n.userData['#'] )
|
||||
}else xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL
|
||||
if( n.isXRFRoot ){
|
||||
defaultFragment = n.userData['#']
|
||||
}
|
||||
xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL
|
||||
}
|
||||
})
|
||||
return defaultFragment
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue