update docs + improve debugging
This commit is contained in:
parent
1645d53238
commit
aefde0ec47
4 changed files with 23 additions and 6 deletions
20
index.html
20
index.html
File diff suppressed because one or more lines are too long
|
|
@ -50,7 +50,9 @@ window.AFRAME.registerComponent('xrf-get', {
|
||||||
this.el.emit("update",{timeout:0})
|
this.el.emit("update",{timeout:0})
|
||||||
|
|
||||||
AFRAME.XRF.addEventListener('reset', () => {
|
AFRAME.XRF.addEventListener('reset', () => {
|
||||||
this.el.remove()
|
try{
|
||||||
|
if( this.el ) this.el.remove()
|
||||||
|
}catch(e){}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ xrf.addEventListener = function(eventName, callback, opts) {
|
||||||
|
|
||||||
xrf.emit = function(eventName, data){
|
xrf.emit = function(eventName, data){
|
||||||
if( typeof data != 'object' ) throw 'emit() requires passing objects'
|
if( typeof data != 'object' ) throw 'emit() requires passing objects'
|
||||||
if( xrf.debug && ( eventName != "render" || xrf.debug == eventName ) ){
|
if( xrf.debug && ( !eventName.match(/^render/) || xrf.debug == eventName ) ){
|
||||||
let label = String(`xrf.emit('${eventName}')`).padEnd(35," ");
|
let label = String(`xrf.emit('${eventName}')`).padEnd(35," ");
|
||||||
label += data.mesh && data.mesh.name ? '#'+data.mesh.name : ''
|
label += data.mesh && data.mesh.name ? '#'+data.mesh.name : ''
|
||||||
console.groupCollapsed(label)
|
console.groupCollapsed(label)
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@ xrf.navigator.to = (url,flags,loader,data) => {
|
||||||
// only change url when loading *another* file
|
// only change url when loading *another* file
|
||||||
if( xrf.model ) xrf.navigator.pushState( `${dir}${file}`, hash )
|
if( xrf.model ) xrf.navigator.pushState( `${dir}${file}`, hash )
|
||||||
xrf.model = model
|
xrf.model = model
|
||||||
|
|
||||||
|
if( !model.isXRF ) xrf.emit('parseModel',{model,url,file}) // loader.load() does this automatically (but not loader.parse)
|
||||||
|
|
||||||
if(xrf.debug ) model.animations.map( (a) => console.log("anim: "+a.name) )
|
if(xrf.debug ) model.animations.map( (a) => console.log("anim: "+a.name) )
|
||||||
// spec: 2. init metadata inside model for non-SRC data
|
// spec: 2. init metadata inside model for non-SRC data
|
||||||
if( !model.isSRC ){
|
if( !model.isSRC ){
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue