repo: janusweb action: commit revision: path_from: revision_from: efadb9940012bc339aa99cd7e51c73222726abf6: path_to: revision_to:
commit efadb9940012bc339aa99cd7e51c73222726abf6 Author: James BaicoianuDate: Wed Sep 11 13:33:37 2024 -0700 Disable touchscreen controls if room.pointerlock is false diff --git a/scripts/janusplayer.js b/scripts/janusplayer.js
--- a/scripts/janusplayer.js
+++ b/scripts/janusplayer.js
@@ -1004,6 +1004,7 @@ document.body.dispatchEvent(click);
}
this.handleTouchStart = function(ev) {
//if (!this.enabled) return;
+ if (!room.pointerlock) return;
let halfscreenwidth = window.innerWidth / 2;
this.enabled = true;
for (let i = 0; i < ev.changedTouches.length; i++) {
@@ -1021,6 +1022,7 @@ document.body.dispatchEvent(click);
this.cancelTouchMovement(ev);
}
this.handleTouchMove = function(ev) {
+ if (!room.pointerlock) return;
if (ev.defaultPrevented) return;
//if (ev.touches.length == 1) {
//var touchindex = this.touchindex;
-----END OF PAGE-----