Merge pull request #15745 from PrestonB1123/hudRemnant

BUGZ-355: Persistent UI Element
This commit is contained in:
Zach Fox 2019-06-12 10:40:37 -07:00 committed by GitHub
commit 5077ae1bd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -457,9 +457,16 @@ function onGeometryChanged(rect) {
}
}
function ensureFirstPersonCameraInHMD(isHMDMode) {
var TIMEOUT_BEFORE_REHIDE_TOOLBAR_MS = 700;
function onDisplayModeChanged(isHMDMode) {
if (isHMDMode) {
Camera.setModeString("first person");
} else if (Settings.getValue("simplifiedUI/keepExistingUIAndScripts", false)) {
// works for now, but not a permanent fix by any means.
Script.setTimeout(function () {
var toolbar = Toolbars.getToolbar(TOOLBAR_NAME);
toolbar.writeProperty("visible", false);
}, TIMEOUT_BEFORE_REHIDE_TOOLBAR_MS);
}
}
@ -505,7 +512,7 @@ function startup() {
updateOutputDeviceMutedOverlay(isOutputMuted());
Audio.mutedDesktopChanged.connect(onDesktopInputDeviceMutedChanged);
Window.geometryChanged.connect(onGeometryChanged);
HMD.displayModeChanged.connect(ensureFirstPersonCameraInHMD);
HMD.displayModeChanged.connect(onDisplayModeChanged);
Audio.avatarGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Audio.localInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
Audio.serverInjectorGainChanged.connect(maybeUpdateOutputDeviceMutedOverlay);
@ -561,7 +568,7 @@ function shutdown() {
Audio.mutedDesktopChanged.disconnect(onDesktopInputDeviceMutedChanged);
Window.geometryChanged.disconnect(onGeometryChanged);
HMD.displayModeChanged.disconnect(ensureFirstPersonCameraInHMD);
HMD.displayModeChanged.disconnect(onDisplayModeChanged);
Audio.avatarGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Audio.localInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);
Audio.serverInjectorGainChanged.disconnect(maybeUpdateOutputDeviceMutedOverlay);