xrfragment-haxe/src/3rd/js/three/xrf/#.js

13 lines
417 B
JavaScript
Raw Normal View History

2024-02-08 19:40:43 +01:00
// this is called by navigator.js rather than by a URL e.g.
2023-10-27 16:55:48 +02:00
xrf.frag.defaultPredefinedViews = (opts) => {
let {scene,model} = opts;
2023-10-27 16:55:48 +02:00
scene.traverse( (n) => {
if( n.userData && n.userData['#'] ){
2024-03-19 09:53:22 +00:00
if( !n.parent && !document.location.hash ){
2024-03-15 10:32:11 +00:00
xrf.navigator.to( n.userData['#'] )
}else xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL
}
2023-10-27 16:55:48 +02:00
})
}