repo: janusweb action: commit revision: path_from: revision_from: f44d8b61400c5d2d5a57aa859826796b1ed583ac: path_to: revision_to:
commit f44d8b61400c5d2d5a57aa859826796b1ed583ac Author: James BaicoianuDate: Sun Mar 10 18:31:54 2024 -0700 iframe focus stealing workaround diff --git a/scripts/janusplayer.js b/scripts/janusplayer.js
--- a/scripts/janusplayer.js
+++ b/scripts/janusplayer.js
@@ -3,6 +3,7 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
elation.component.add('engine.things.janusplayer', function() {
//this.defaultavatar = '\n \n \n \n \n \n \n \n \n '
+ //this.defaultavatar = '\n\n \n\n \n \n ';
this.defaultavatar = `
@@ -103,6 +104,17 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
this.cursor_style = 'default';
this.cursor_object = '';
this.lookat_object = '';
+ window.addEventListener('blur', ev => {
+ if (document.pointerLockElement && document.activeElement instanceof HTMLIFrameElement) {
+ document.pointerLockElement.focus();
+//this.disable();
+ this.engine.systems.controls.deactivateContext('janusplayer');
+ this.engine.systems.controls.activateContext('janusplayer');
+let click = new MouseEvent('click', { });
+document.body.dispatchEvent(click);
+//setTimeout(() => this.enable(), 100);
+ }
+ });
if (this.usevoip) {
this.voip = new JanusVOIPRecorder({audioScale: 1024});
@@ -886,8 +898,9 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
this.setCollider('sphere', {
radius: this.collision_radius,
});
-*/
this.pickable = false;
+ this.collidable = false;
+*/
this.setCollider('capsule', {
radius: this.collision_radius,
length: 1,
@@ -963,6 +976,7 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
}
}
this.handleTouchStart = function(ev) {
+ //if (!this.enabled) return;
let halfscreenwidth = window.innerWidth / 2;
this.enabled = true;
for (let i = 0; i < ev.changedTouches.length; i++) {
@@ -1124,8 +1138,10 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
elapsed = now - this.lookAtLERPstart,
n = Math.min(1, Math.max(0, elapsed / this.lookAtLERPtime));
- THREE.Quaternion.slerp(this.lookAtLERPq1body, this.lookAtLERPq2body, this.orientation, n);
- THREE.Quaternion.slerp(this.lookAtLERPq1head, this.lookAtLERPq2head, this.head.orientation, n);
+ //THREE.Quaternion.slerp(this.lookAtLERPq1body, this.lookAtLERPq2body, this.orientation, n);
+ //THREE.Quaternion.slerp(this.lookAtLERPq1head, this.lookAtLERPq2head, this.head.orientation, n);
+ this.orientation.slerpQuaternions(this.lookAtLERPq1body, this.lookAtLERPq2body, n);
+ this.head.orientation.slerpQuaternions(this.lookAtLERPq1head, this.lookAtLERPq2head, n);
if (n == 1) {
this.lookAtLERPtime = 0;
}
-----END OF PAGE-----