From 405be471c32e8dbd8448329af0fcb5b070514c5a Mon Sep 17 00:00:00 2001 From: Faye Li Date: Fri, 24 Mar 2017 13:47:19 -0700 Subject: [PATCH] button state change --- .../render/photobooth/photoboothApp.js | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/developer/utilities/render/photobooth/photoboothApp.js b/scripts/developer/utilities/render/photobooth/photoboothApp.js index c193513b35..675db14be3 100644 --- a/scripts/developer/utilities/render/photobooth/photoboothApp.js +++ b/scripts/developer/utilities/render/photobooth/photoboothApp.js @@ -23,14 +23,25 @@ }); function onClicked() { - tablet.gotoWebScreen(PHOTOBOOTH_WINDOW_HTML_URL); - // Initialise the photobooth if it wasn't created already - if (!photoboothCreated) { + if (photoboothCreated) { + tablet.gotoHomeScreen(); + PhotoBooth.destroy(); + } else { + tablet.gotoWebScreen(PHOTOBOOTH_WINDOW_HTML_URL); PhotoBooth.init(); - photoboothCreated = true; } - } + + function onScreenChanged() { + if (photoboothCreated) { + tablet.gotoHomeScreen(); + PhotoBooth.destroy(); + button.editProperties({isActive: false}); + } else { + button.editProperties({isActive: true}); + } + } + tablet.screenChanged.connect(onScreenChanged); button.clicked.connect(onClicked); tablet.webEventReceived.connect(onWebEventReceived); @@ -87,6 +98,7 @@ } PhotoBooth.init = function () { + photoboothCreated = true; var success = Clipboard.importEntities(PHOTOBOOTH_SETUP_JSON_URL); var frontFactor = 10; // getForward is preffered as getFront function is deprecated