|
642 | 642 | }; |
643 | 643 | rtcWs.pushAssets = () => { |
644 | 644 | const landXrIframe = root.childNodes[0]; |
645 | | - const extentXrIframes = _getChildXrIframes(landXrIframe); |
| 645 | + const extentXrIframes = _getExtentXrIframes(landXrIframe); |
646 | 646 | const assetXrIframes = extentXrIframes.map(extentXrIframe => _getChildXrIframes(extentXrIframe)).flat(); |
647 | 647 | const html = `<xr-site>\n${assetXrIframes.filter(xrIframe => !!xrIframe.id).map(xrIframe => ' ' + xrIframe.outerHTML).join('\n')}\n</xr-site>\n`; |
648 | 648 | rtcWs.send(JSON.stringify({ |
|
3629 | 3629 | const rects = []; |
3630 | 3630 | const covers = []; |
3631 | 3631 | const _getChildXrIframes = xrIframe => Array.from(xrIframe.contentWindow.iframe.contentDocument.querySelectorAll('xr-iframe')); |
| 3632 | +const _getExtentXrIframes = xrIframe => _getChildXrIframes(xrIframe).filter(xrIframe => !/^owned:/.test(xrIframe.id); |
| 3633 | +const _getOwnedXrIframes = xrIframe => _getChildXrIframes(xrIframe).filter(xrIframe => /^owned:/.test(xrIframe.id); |
3632 | 3634 | const _connectLand = async () => { |
3633 | 3635 | if (!landState) { |
3634 | 3636 | let live = true; |
|
3648 | 3650 | xrIframe.addEventListener('error', reject); |
3649 | 3651 | }); |
3650 | 3652 | if (!live) return; |
3651 | | - const xrIframes = _getChildXrIframes(xrIframe); |
| 3653 | + const xrIframes = _getExtentXrIframes(xrIframe); |
3652 | 3654 |
|
3653 | 3655 | const _loadInventory = () => { |
3654 | 3656 | fetch(`${LAMBDA_URLS.inventory}?email=${encodeURIComponent(loginToken.email)}&token=${encodeURIComponent(loginToken.token)}`) |
|
4291 | 4293 | _rtcConnect('land', loginToken.name, 'land', async state => { |
4292 | 4294 | await p; |
4293 | 4295 |
|
| 4296 | + // emit extent's id'd xr-iframes |
| 4297 | + |
4294 | 4298 | const landXrIframe = root.childNodes[0]; |
4295 | | - const extentXrIframes = _getChildXrIframes(landXrIframe); |
| 4299 | + const extentXrIframes = _getExtentXrIframes(landXrIframe); |
4296 | 4300 | const assetXrIframes = extentXrIframes.map(extentXrIframe => _getChildXrIframes(extentXrIframe)).flat(); |
4297 | 4301 |
|
4298 | 4302 | const stateXrSite = state.childNodes.find(node => node.tagName === 'xr-site'); |
|
4328 | 4332 | xrIframe.src = href; |
4329 | 4333 | xrIframe.name = name; |
4330 | 4334 | if (landState) { |
4331 | | - xrIframe.id = `${connectionId}-${_randomString()}`; |
| 4335 | + xrIframe.id = `owned:${connectionId}-${_randomString()}`; |
4332 | 4336 | } |
4333 | 4337 | root.appendChild(xrIframe); |
4334 | 4338 | root.update(); // force mutation observer to run |
|
0 commit comments