xrfragment-haxe/src/3rd/js/three/xrf/dynamic/index.js

16 lines
470 B
JavaScript
Raw Normal View History

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['#'] ){
let frag = xrf.URI.parse( n.userData['#'] )
2023-11-02 21:23:35 +01:00
xrf.hashbus.pub( n.userData['#'] ) // evaluate static XR fragments
}
2023-10-27 16:55:48 +02:00
})
}
// clicking href url with predefined view
xrf.addEventListener('href', (opts) => {
if( !opts.click || opts.xrf.string[0] != '#' ) return
xrf.hashbus.pub( opts.xrf.string )
})