Skip to content

Commit 4a13531

Browse files
author
Avaer Kazmer
committed
Add channel switcher
1 parent 1128290 commit 4a13531

File tree

2 files changed

+35
-21
lines changed

2 files changed

+35
-21
lines changed

app.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,7 +3252,7 @@
32523252

32533253
const uiSize = 2048;
32543254
let renderIds = 0;
3255-
const _renderUi = (searchString, selectedTab) => new Promise((accept, reject) => {
3255+
const _renderUi = (searchString, selectedTab, selectedChannel) => new Promise((accept, reject) => {
32563256
if (renderIds > 0) {
32573257
uiIframe.contentWindow.postMessage({
32583258
method: 'cancel',
@@ -3288,6 +3288,9 @@
32883288
tab2: selectedTab === 2,
32893289
tab3: selectedTab === 3,
32903290
tab4: selectedTab === 4,
3291+
channel1: selectedChannel === 1,
3292+
channel2: selectedChannel === 2,
3293+
channel3: selectedChannel === 3,
32913294
},
32923295
width: uiSize,
32933296
height: uiSize,
@@ -3409,9 +3412,10 @@
34093412
};
34103413

34113414
let selectedTab = 1;
3415+
let selectedChannel = 1;
34123416
let anchors = [];
34133417
const _updateTextureDynamic = async () => {
3414-
const result = await _renderUi(text, selectedTab);
3418+
const result = await _renderUi(text, selectedTab, selectedChannel);
34153419
if (result.data) {
34163420
ctx.putImageData(new ImageData(new Uint8ClampedArray(result.data.buffer, result.data.byteOffset, result.data.byteLength), uiSize, uiSize), 0, 0);
34173421
}
@@ -3590,6 +3594,10 @@
35903594
keyboardFocus = null;
35913595
_updateTextureDynamic();
35923596
};
3597+
const _setChannel = newChannel => {
3598+
selectedChannel = newChannel;
3599+
_updateTextureDynamic();
3600+
};
35933601
mesh.click = async (intersectionSpec, controllerIndex) => {
35943602
keyboardFocus = null;
35953603

@@ -3638,6 +3646,12 @@
36383646
method: 'saveScene',
36393647
html: root.outerHTML,
36403648
});
3649+
} else if (id === 'channel-local') {
3650+
_setChannel(1);
3651+
} else if (id === 'channel-shared') {
3652+
_setChannel(2);
3653+
} else if (id === 'channel-global') {
3654+
_setChannel(3);
36413655
} else if (href) {
36423656
const xrIframe = document.createElement('xr-iframe');
36433657
xrIframe.src = href;

interface.html

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,17 @@
160160
.actions .action .wrap p {
161161
font-size: 36px;
162162
}
163-
.metasites {
163+
.channels {
164164
display: flex;
165165
flex-direction: column;
166166
}
167-
.metasites .metasite {
167+
.channels .channel {
168168
position: relative;
169169
display: flex;
170170
height: 340px;
171171
padding: 60px;
172172
}
173-
.metasites .metasite .border {
173+
.channels .channel .border {
174174
position: absolute;
175175
left: 30px;
176176
right: 30px;
@@ -179,13 +179,13 @@
179179
// border: 10px solid transparent;
180180
border-radius: 20px;
181181
}
182-
.metasites .metasite.selected {
182+
.channels .channel.selected {
183183
color: #FFF;
184184
}
185-
.metasites .metasite.selected .border {
185+
.channels .channel.selected .border {
186186
background-color: #000;
187187
}
188-
.metasites .metasite .icon {
188+
.channels .channel .icon {
189189
position: relative;
190190
display: flex;
191191
width: 200px;
@@ -197,23 +197,23 @@
197197
justify-content: center;
198198
align-items: center;
199199
}
200-
.metasites .metasite .wrap {
200+
.channels .channel .wrap {
201201
position: relative;
202202
display: flex;
203203
flex-direction: column;
204204
}
205-
.metasites .metasite .wrap h1,
206-
.metasites .metasite .wrap h2,
207-
.metasites .metasite .wrap h3,
208-
.metasites .metasite .wrap p
205+
.channels .channel .wrap h1,
206+
.channels .channel .wrap h2,
207+
.channels .channel .wrap h3,
208+
.channels .channel .wrap p
209209
{
210210
margin: 0;
211211
}
212-
.metasites .metasite .wrap h3 {
212+
.channels .channel .wrap h3 {
213213
font-size: 60px;
214214
line-height: 1.6;
215215
}
216-
.metasites .metasite .wrap p {
216+
.channels .channel .wrap p {
217217
font-size: 50px;
218218
}
219219
</style>
@@ -228,7 +228,7 @@
228228
<a id=tab-1 class="radio {{#tab1}}selected{{/tab1}}">WebXR</a>
229229
<a id=tab-2 class="radio {{#tab2}}selected{{/tab2}}">Actions</a>
230230
<a id=tab-3 class="radio {{#tab3}}selected{{/tab3}}">Avatar</a>
231-
<a id=tab-4 class="radio {{#tab4}}selected{{/tab4}}">Metasite</a>
231+
<a id=tab-4 class="radio {{#tab4}}selected{{/tab4}}">Channel</a>
232232
</div>
233233
{{#tab1}}
234234
<div class=results>
@@ -256,7 +256,7 @@ <h3>{{label}}</h3>
256256
</div>
257257
<div class=wrap>
258258
<h3>New scene</h3>
259-
<p>Clear your metasite scene</p>
259+
<p>Clear your scene</p>
260260
</div>
261261
</a>
262262
<a id=action-copy-scene class=action>
@@ -302,8 +302,8 @@ <h3>Save scene</h3>
302302
</div>
303303
{{/tab2}}
304304
{{#tab4}}
305-
<div class=metasites>
306-
<a id=metasite-local class="metasite selected">
305+
<div class=channels>
306+
<a id=channel-local class="channel {{#channel1}}selected{{/channel1}}">
307307
<div class=border></div>
308308
<div class=icon>
309309
<i class="fal fa-street-view"></i>
@@ -314,7 +314,7 @@ <h3>Local</h3>
314314
<p>Your home space</p>
315315
</div>
316316
</a>
317-
<a id=metasite-shared class=metasite>
317+
<a id=channel-shared class="channel {{#channel2}}selected{{/channel2}}">
318318
<div class=border></div>
319319
<div class=icon>
320320
<i class="fal fa-couch"></i>
@@ -324,7 +324,7 @@ <h3>Shared</h3>
324324
<p>Shared space for your friends</p>
325325
</div>
326326
</a>
327-
<a id=metasite-global class=metasite>
327+
<a id=channel-global class="channel {{#channel3}}selected{{/channel3}}">
328328
<div class=border></div>
329329
<div class=icon>
330330
<i class="fal fa-map-marked-alt"></i>

0 commit comments

Comments
 (0)