Hide the pointer capture button unless in fullscreen
This change is a compromise to de-clutter the navbar by only showing the pointer capture button when fullscreen is enabled. There is no strong requirement (from the browser side) to be in fullscreen to acquire a pointer lock.
This commit is contained in:
parent
30fda3c948
commit
a7f4d708ca
|
|
@ -1251,6 +1251,7 @@ const UI = {
|
|||
document.getElementById('noVNC_fullscreen_button')
|
||||
.classList.remove("noVNC_selected");
|
||||
}
|
||||
UI.updatePointerLockButton();
|
||||
},
|
||||
|
||||
/* ------^-------
|
||||
|
|
@ -1308,8 +1309,13 @@ const UI = {
|
|||
|
||||
updatePointerLockButton() {
|
||||
// Only show the button if the pointer lock API is properly supported
|
||||
// AND in fullscreen.
|
||||
if (
|
||||
UI.connected &&
|
||||
(document.fullscreenElement || // alternative standard method
|
||||
document.mozFullScreenElement || // currently working methods
|
||||
document.webkitFullscreenElement ||
|
||||
document.msFullscreenElement) &&
|
||||
(document.pointerLockElement !== undefined ||
|
||||
document.mozPointerLockElement !== undefined)
|
||||
) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue