Skip to content

Commit 765bbcd

Browse files
author
Avaer Kazmer
committed
Specially tag owned xr-iframes in land mode
1 parent b4f6cc6 commit 765bbcd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

app.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@
642642
};
643643
rtcWs.pushAssets = () => {
644644
const landXrIframe = root.childNodes[0];
645-
const extentXrIframes = _getChildXrIframes(landXrIframe);
645+
const extentXrIframes = _getExtentXrIframes(landXrIframe);
646646
const assetXrIframes = extentXrIframes.map(extentXrIframe => _getChildXrIframes(extentXrIframe)).flat();
647647
const html = `<xr-site>\n${assetXrIframes.filter(xrIframe => !!xrIframe.id).map(xrIframe => ' ' + xrIframe.outerHTML).join('\n')}\n</xr-site>\n`;
648648
rtcWs.send(JSON.stringify({
@@ -3629,6 +3629,8 @@
36293629
const rects = [];
36303630
const covers = [];
36313631
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);
36323634
const _connectLand = async () => {
36333635
if (!landState) {
36343636
let live = true;
@@ -3648,7 +3650,7 @@
36483650
xrIframe.addEventListener('error', reject);
36493651
});
36503652
if (!live) return;
3651-
const xrIframes = _getChildXrIframes(xrIframe);
3653+
const xrIframes = _getExtentXrIframes(xrIframe);
36523654

36533655
const _loadInventory = () => {
36543656
fetch(`${LAMBDA_URLS.inventory}?email=${encodeURIComponent(loginToken.email)}&token=${encodeURIComponent(loginToken.token)}`)
@@ -4291,8 +4293,10 @@
42914293
_rtcConnect('land', loginToken.name, 'land', async state => {
42924294
await p;
42934295

4296+
// emit extent's id'd xr-iframes
4297+
42944298
const landXrIframe = root.childNodes[0];
4295-
const extentXrIframes = _getChildXrIframes(landXrIframe);
4299+
const extentXrIframes = _getExtentXrIframes(landXrIframe);
42964300
const assetXrIframes = extentXrIframes.map(extentXrIframe => _getChildXrIframes(extentXrIframe)).flat();
42974301

42984302
const stateXrSite = state.childNodes.find(node => node.tagName === 'xr-site');
@@ -4328,7 +4332,7 @@
43284332
xrIframe.src = href;
43294333
xrIframe.name = name;
43304334
if (landState) {
4331-
xrIframe.id = `${connectionId}-${_randomString()}`;
4335+
xrIframe.id = `owned:${connectionId}-${_randomString()}`;
43324336
}
43334337
root.appendChild(xrIframe);
43344338
root.update(); // force mutation observer to run

0 commit comments

Comments
 (0)