From 68662bb209f1cc92da2616676883d4a0d9545da8 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 15 Jun 2017 10:20:17 -0700 Subject: [PATCH] Bugfixes --- scripts/system/spectatorCamera.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/system/spectatorCamera.js b/scripts/system/spectatorCamera.js index f8186f26fe..6095a960cd 100644 --- a/scripts/system/spectatorCamera.js +++ b/scripts/system/spectatorCamera.js @@ -197,7 +197,7 @@ // showInDesktop: Set to "true" to show the "SPECTATOR" app in desktop mode // // Arguments: - // shouldntAdd: Set to "true" if you don't want to add the button, i.e. upon shutdown + // isShuttingDown: Set to "true" if you're calling this function upon script shutdown // isHMDMode: "true" if user is in HMD; false otherwise // // Description: @@ -207,18 +207,20 @@ var buttonName = "SPECTATOR"; var tablet = null; var showSpectatorInDesktop = true; - function addOrRemoveButton(shouldntAdd, isHMDMode) { + function addOrRemoveButton(isShuttingDown, isHMDMode) { if (!button) { - if ((isHMDMode || showSpectatorInDesktop) && !shouldntAdd) { + if ((isHMDMode || showSpectatorInDesktop) && !isShuttingDown) { button = tablet.addButton({ text: buttonName }); button.clicked.connect(onTabletButtonClicked); } } else if (button) { - button.clicked.disconnect(onTabletButtonClicked); - tablet.removeButton(button); - button = false; + if ((!showSpectatorInDesktop || isShuttingDown) && !isHMDMode) { + button.clicked.disconnect(onTabletButtonClicked); + tablet.removeButton(button); + button = false; + } } else { print("ERROR adding/removing Spectator button!"); }