janusweb 1.5.37 → 1.5.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/css/janusweb.css CHANGED
@@ -301,3 +301,6 @@ janus-overlay[hidden] {
301
301
  pointer-events: none;
302
302
  display: block !important;
303
303
  }
304
+ fireboxroom {
305
+ display: none;
306
+ }
@@ -42,15 +42,14 @@ elation.elements.define('janus-avatar-picker', class extends elation.elements.ba
42
42
  this.defineAttribute('src', { type: 'string' });
43
43
  this.defineAttribute('sources', { type: 'object' });
44
44
  this.defineAttribute('previewpos', { type: 'vector3', default: V(-2, 0, -3) });
45
- this.defineAttribute('hideconfirm', { type: 'boolean', default: false });
46
- this.defineAttribute('hidereset', { type: 'boolean', default: false });
45
+ this.defineAttribute('hideconfirm', { type: 'boolean', default: true });
46
+ this.defineAttribute('hidereset', { type: 'boolean', default: true });
47
47
  this.selected = false;
48
48
  }
49
49
  create() {
50
50
  let tpl = '';
51
51
  if (this.sources) {
52
52
  let sources = (elation.utils.isString(this.sources) ? JSON.parse(this.sources) : this.sources);
53
- console.log('HI YES', sources);
54
53
  if (sources.length > 1) {
55
54
  tpl += '<ui-tabs>';
56
55
  sources.forEach(source => {
@@ -68,7 +67,7 @@ elation.elements.define('janus-avatar-picker', class extends elation.elements.ba
68
67
  <ui-list name="avatar" selectable="1" collection="avatarlist" itemcomponent="janus-avatar-picker-item"></ui-list>
69
68
  </ui-tab>
70
69
  <ui-tab label="Ready Player Me">
71
- <iframe src="https://demo.readyplayer.me/avatar" allow="camera"></iframe>
70
+ <iframe data-src="https://demo.readyplayer.me/avatar" allow="camera"></iframe>
72
71
  </ui-tab>
73
72
  </ui-tabs>
74
73
  `;
@@ -93,7 +92,7 @@ elation.elements.define('janus-avatar-picker', class extends elation.elements.ba
93
92
 
94
93
  // Observer watches for visibility events and hides the 3d avatar preview when the 2d ui disappears
95
94
  let threshold = [];
96
- for (let i = 0; i < 100; i++) threshold.push(i / 100);
95
+ for (let i = 0; i < 100; i += 10) threshold.push(i / 100);
97
96
  let observer = new IntersectionObserver(ev => this.handleIntersectionChange(ev), { root: document, rootMargin: '0px', threshold: threshold });
98
97
  observer.observe(this);
99
98
  document.addEventListener('scroll', ev => this.handleScroll(ev));
@@ -107,7 +106,7 @@ elation.elements.define('janus-avatar-picker', class extends elation.elements.ba
107
106
  <ui-list name="avatar" selectable="1" collection="avatarlist" itemcomponent="janus-avatar-picker-item"></ui-list>
108
107
  `;
109
108
  } else if (source.type == 'iframe') {
110
- tpl = `<iframe src="${source.src}" allow="camera"></iframe>`;
109
+ tpl = `<iframe data-src="${source.src}" allow="camera"></iframe>`;
111
110
  }
112
111
  return tpl;
113
112
  }
@@ -178,9 +177,11 @@ this.appendChild(this.previewwindow);
178
177
  handleAvatarSelect(ev) {
179
178
  console.log('selected an avatar', ev.data);
180
179
  this.selected = ev.data;
181
- this.showPreview(ev.data.url);
182
180
  if (this.elements.confirm) {
181
+ this.showPreview(ev.data.url);
183
182
  this.elements.confirm.disabled = false;
183
+ } else {
184
+ this.handleAvatarConfirm();
184
185
  }
185
186
  this.dispatchEvent(new CustomEvent("select", { detail: this.selected }));
186
187
  }
@@ -204,6 +205,21 @@ this.appendChild(this.previewwindow);
204
205
  } else if (!this.avatarpreview && intersections[0].isIntersecting) {
205
206
  this.showPreview();
206
207
  }
208
+ // If our iframe hasn't been loaded yet, set a timer to load it. Clear the time out if the element becomes hidden before it fires.
209
+ if (intersections[0].intersectionRatio > 0) {
210
+ if (this.iframevistimer) {
211
+ clearTimeout(this.iframevistimer);
212
+ }
213
+ this.iframevistimer = setTimeout(() => {
214
+ let iframe = this.querySelector('iframe[data-src]');
215
+ if (iframe && iframe.src != iframe.dataset.src) {
216
+ iframe.src = iframe.dataset.src;
217
+ delete iframe.dataset.src;
218
+ }
219
+ }, 50);
220
+ } else if (this.iframevistimer) {
221
+ clearTimeout(this.iframevistimer);
222
+ }
207
223
  }
208
224
  handleScroll(ev) {
209
225
  this.updatePreviewPosition();
@@ -229,7 +245,8 @@ this.appendChild(this.previewwindow);
229
245
  });
230
246
  elation.elements.define('janus-avatar-picker-item', class extends elation.elements.ui.item {
231
247
  create() {
232
- elation.events.add(this, 'click', (ev) => { console.log('duh', this); this.click(ev) });
248
+ super.create();
249
+ //elation.events.add(this, 'click', (ev) => { console.log('duh', this); this.click(ev) });
233
250
  let item = this.value;
234
251
  let defaulticon = janus.ui.apps.default.apps.avatar.resolveFullURL('./images/default-avatar.jpg');
235
252
  this.elements = elation.elements.fromString(`
@@ -6,7 +6,6 @@
6
6
  "./buttons.css"
7
7
  ],
8
8
  "scripts": [
9
- "./share-min.js",
10
9
  "./buttons.js"
11
10
  ]
12
11
  }
@@ -2,4 +2,4 @@
2
2
 
3
3
  <janus-comms-userlist labelfont="{labelfont}"></janus-comms-userlist>
4
4
  <!-- janus-voip-client></janus-voip-client -->
5
- <janus-comms-chat></janus-comms-chat>
5
+ <janus-comms-chat name="chat"></janus-comms-chat>
@@ -93,16 +93,17 @@ elation.elements.define('janus-comms-userlist', class extends elation.elements.u
93
93
  this.elements = elation.elements.fromTemplate('janus.comms.userlist', this);
94
94
  this.client = this.getClient();
95
95
  this.janusweb = this.client.janusweb;
96
+
96
97
  this.userlist_room = this.elements.userlist_room;
97
98
  this.userlist_online = this.elements.userlist_online;
98
99
  this.userlist_friends = this.elements.userlist_friends;
99
-
100
100
  this.usermarkers = {};
101
101
 
102
102
  elation.events.add(this.janusweb, 'room_load_start', (ev) => { this.updateRoom(ev.data); });
103
103
  elation.events.add(this.janusweb.network, 'janusweb_user_joined,janusweb_user_left,janusweb_user_disconnected', (ev) => this.updateUsers());
104
104
  setTimeout(() => {
105
105
  this.updateUsers();
106
+ this.updateRoom(room);
106
107
  }, 100);
107
108
  }
108
109
  getClient() {
@@ -121,6 +122,13 @@ elation.elements.define('janus-comms-userlist', class extends elation.elements.u
121
122
  this.userlist_room = this.userlist_room;
122
123
  this.userlist_online = this.userlist_online;
123
124
  this.userlist_friends = this.userlist_friends;
125
+ if (room.private) {
126
+ this.parentNode.elements.chat.open = false;
127
+ this.elements.userlist_details.open = false;
128
+ } else {
129
+ this.parentNode.elements.chat.open = true;
130
+ this.elements.userlist_details.open = true;
131
+ }
124
132
  this.updateUsers();
125
133
  }
126
134
  updateUsers() {
@@ -129,10 +137,12 @@ elation.elements.define('janus-comms-userlist', class extends elation.elements.u
129
137
  var users = Object.keys(remoteplayers);
130
138
  users.unshift(player.userid);
131
139
 
132
- this.elements.roomusers.value = users.length;
133
-
134
- this.userlist_room.setItems(users);
135
-
140
+ if (this.elements.roomusers) {
141
+ this.elements.roomusers.value = users.length;
142
+ }
143
+ if (this.userlist_room) {
144
+ this.userlist_room.setItems(users);
145
+ }
136
146
  for (let k in remoteplayers) {
137
147
  let p = remoteplayers[k];
138
148
  if (this.usermarkers[k] && this.usermarkers[k].parent !== p.getProxyObject()) {
@@ -147,7 +157,6 @@ elation.elements.define('janus-comms-userlist', class extends elation.elements.u
147
157
  });
148
158
  this.usermarkers[k].start();
149
159
  }
150
-
151
160
  }
152
161
  }
153
162
  setFont(fontname) {
@@ -207,6 +216,7 @@ elation.elements.define('janus-comms-chat', class extends elation.elements.base
207
216
  }
208
217
  handleUserJoined(ev) {
209
218
  var data = ev.data;
219
+ if (!this.elements.chatmessages) return;
210
220
  this.elements.chatmessages.add({
211
221
  timestamp: new Date().getTime(),
212
222
  type: 'join',
@@ -217,6 +227,7 @@ elation.elements.define('janus-comms-chat', class extends elation.elements.base
217
227
  }
218
228
  handleUserLeft(ev) {
219
229
  var data = ev.data;
230
+ if (!this.elements.chatmessages) return;
220
231
  this.elements.chatmessages.add({
221
232
  timestamp: new Date().getTime(),
222
233
  type: 'part',
@@ -227,6 +238,7 @@ elation.elements.define('janus-comms-chat', class extends elation.elements.base
227
238
  }
228
239
  handleUserDisconnected(ev) {
229
240
  var data = ev.data;
241
+ if (!this.elements.chatmessages) return;
230
242
  this.elements.chatmessages.add({
231
243
  timestamp: new Date().getTime(),
232
244
  type: 'disconnect',
@@ -237,6 +249,7 @@ elation.elements.define('janus-comms-chat', class extends elation.elements.base
237
249
  }
238
250
  handleUserChat(ev) {
239
251
  var data = ev.data;
252
+ if (!this.elements.chatmessages) return;
240
253
  this.elements.chatmessages.add({
241
254
  timestamp: new Date().getTime(),
242
255
  type: 'chat',
@@ -249,6 +262,7 @@ elation.elements.define('janus-comms-chat', class extends elation.elements.base
249
262
  sendMessage(msg) {
250
263
  if (msg && msg.length > 0) {
251
264
  janus.network.send({'method': 'chat', data: msg});
265
+ if (!this.elements.chatmessages) return;
252
266
  this.elements.chatmessages.add({
253
267
  timestamp: new Date().getTime(),
254
268
  type: 'selfchat',
@@ -260,6 +274,7 @@ elation.elements.define('janus-comms-chat', class extends elation.elements.base
260
274
  }
261
275
  }
262
276
  handleClientPrint(msg) {
277
+ if (!this.elements.chatmessages) return;
263
278
  this.elements.chatmessages.add({
264
279
  timestamp: new Date().getTime(),
265
280
  type: 'print',
@@ -1,9 +1,11 @@
1
- <details open>
2
- <summary>Online Users (<ui-indicator name="roomusers" value="0"></ui-indicator>)</summary>
3
- {?room.private}
4
- <h3>Private Room</h3>
1
+ {?room.private}
2
+ <details name="userlist_details">
3
+ <summary>No online users</summary>
5
4
  <p>This room is marked as private. You are not broadcasting your location while here - others can't see you, and you can't see them.</p>
6
- {/room.private}
5
+ </details>
6
+ {:else}
7
+ <details open name="userlist_details">
8
+ <summary>Online Users (<ui-indicator name="roomusers" value="0"></ui-indicator>)</summary>
7
9
  <ui-list name="userlist_room" emptycontent="No other users in this room"></ui-list>
8
10
  <!-- ui-tabs showcounts="true">
9
11
  <ui-tab name="roomusers" label="Room">
@@ -17,3 +19,4 @@
17
19
  </ui-tab>
18
20
  </ui-tabs -->
19
21
  </details>
22
+ {/room.private}
@@ -96,7 +96,7 @@ this.debug.style.zIndex = '1000';
96
96
  this.style.top = (this.position[1] * 100) + '%';
97
97
  }
98
98
 
99
- let janus = elation.component.fetch(this.queryParentSelector('[data-elation-component="janusweb.client"]'))
99
+ let janus = this.queryParentSelector('janusweb-client');
100
100
  if (janus) {
101
101
  janus.engine.systems.controls.addVirtualGamepad(this);
102
102
  this.hide();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "janusweb",
3
3
  "description": "Web client for JanusVR worlds",
4
- "version": "1.5.37",
4
+ "version": "1.5.41",
5
5
  "main": "scripts/janusweb.js",
6
6
  "author": "James Baicoianu",
7
7
  "license": "MIT",
@@ -83,6 +83,7 @@ JanusFireboxParser.prototype.parseAssets = function(xml, baseurl, datapath) {
83
83
  flipy: n.flipy,
84
84
  reverse3d: n.reverse3d,
85
85
  tex_linear: n.tex_linear,
86
+ equi: n.equi,
86
87
  });
87
88
  });
88
89
  videoassets.forEach(function(n) {
@@ -238,15 +238,34 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
238
238
  //rotation: V(0, 180, 0),
239
239
  lighting: this.lighting,
240
240
  //cull_face: 'none'
241
+ opacity: 0.9999,
242
+ renderorder: this.renderorder || 100,
243
+ shader_chunk_replace: (this.lighting ? {
244
+ 'color_fragment': 'color_fragment_discard_close',
245
+ } : {}),
241
246
  });
242
247
  this.face.start();
243
248
  } else {
244
249
  this.face = headid;
250
+ this.face.lighting = this.lighting;
251
+ this.face.opacity = 0.9999;
252
+ this.face.renderorder = this.renderorder || 100;
253
+ this.face.shader_chunk_replace = (this.lighting ? {
254
+ 'color_fragment': 'color_fragment_discard_close',
255
+ } : {});
245
256
  this.head.appendChild(headid);
246
257
  this.face.start();
247
258
  }
248
- this.head.pos = headpos.clone().multiplyScalar(this.scale.y);
259
+ if (scale) {
260
+ this.face.scale.fromArray(scale);
261
+ if (this.label) {
262
+ this.label.scale.fromArray(scale);
263
+ this.label.pos.multiply(this.label.scale);
264
+ }
265
+ }
266
+ this.head.pos = headpos.clone().multiply(this.face.scale);
249
267
  this.face.applyPosition(headpos.negate());
268
+
250
269
  if (this.remotevideo) {
251
270
  this.updateVideoScreen();
252
271
  this.face.addEventListener('load', (ev) => {
@@ -256,13 +275,7 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
256
275
  }
257
276
  }
258
277
  //this.head.properties.position.copy(headpos);
259
- if (scale) {
260
- this.face.scale.fromArray(scale);
261
- if (this.label) {
262
- this.label.scale.fromArray(scale);
263
- this.label.pos.multiply(this.label.scale);
264
- }
265
- }
278
+
266
279
  }
267
280
  }
268
281
  this.setBody = function(bodyid, scale, pos) {
@@ -328,7 +341,7 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
328
341
  if (this.body.animationmixer) {
329
342
  this.cloneAnimations(animasset);
330
343
  }
331
- this.body.setAnimation('idle');
344
+ //this.body.setAnimation('idle');
332
345
  }
333
346
  });
334
347
  animasset.load();
@@ -336,7 +349,7 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
336
349
  if (this.body.animationmixer) {
337
350
  this.cloneAnimations(animasset);
338
351
  }
339
- this.body.setAnimation('idle');
352
+ //this.body.setAnimation('idle');
340
353
  }
341
354
  }
342
355
  this.cloneAnimations = function(animasset) {
@@ -373,7 +373,6 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
373
373
  if (this.head) {
374
374
  this.head.objects['3d'].matrixWorld.extractBasis(v.view_xdir, v.view_ydir, v.view_zdir);
375
375
  v.head_pos.setFromMatrixPosition(this.head.objects['3d'].matrixWorld);
376
- v.view_zdir.negate();
377
376
  }
378
377
 
379
378
  if (this.gaze && this.gaze.object) {
@@ -491,7 +490,7 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
491
490
  avatar_src: 'data:text/plain,' + encodeURIComponent(avatar),
492
491
  showlabel: false,
493
492
  //pos: V(0, -this.fatness, 0),
494
- //rotation: V(0, 180, 0),
493
+ rotation: V(0, 180, 0),
495
494
  renderorder: 101,
496
495
  });
497
496
  this.ghost.orientation.set(0,1,0,0);
@@ -655,7 +654,7 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
655
654
  avatar_src: 'data:text/plain,' + encodeURIComponent(avatar),
656
655
  showlabel: false,
657
656
  //pos: V(0, -this.fatness, 0),
658
- //rotation: V(0, 180, 0),
657
+ rotation: V(0, 180, 0),
659
658
  renderorder: 101,
660
659
  });
661
660
 
package/scripts/room.js CHANGED
@@ -306,6 +306,7 @@ elation.require([
306
306
  let equi = this.getAsset('image', this.skybox_equi);
307
307
  elation.events.add(equi, 'asset_load', ev => {
308
308
  this.skyboxtexture = ev.target._texture;
309
+ this.skyboxtexture.mapping = THREE.EquirectangularReflectionMapping;
309
310
  if (this.janus.currentroom === this) {
310
311
  this.skyboxobj.setTexture(this.skyboxtexture);
311
312
  }