button state change

This commit is contained in:
Faye Li 2017-03-24 13:47:19 -07:00
parent ccd4fdb540
commit 405be471c3

View file

@ -23,14 +23,25 @@
}); });
function onClicked() { function onClicked() {
tablet.gotoWebScreen(PHOTOBOOTH_WINDOW_HTML_URL); if (photoboothCreated) {
// Initialise the photobooth if it wasn't created already tablet.gotoHomeScreen();
if (!photoboothCreated) { PhotoBooth.destroy();
} else {
tablet.gotoWebScreen(PHOTOBOOTH_WINDOW_HTML_URL);
PhotoBooth.init(); 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); button.clicked.connect(onClicked);
tablet.webEventReceived.connect(onWebEventReceived); tablet.webEventReceived.connect(onWebEventReceived);
@ -87,6 +98,7 @@
} }
PhotoBooth.init = function () { PhotoBooth.init = function () {
photoboothCreated = true;
var success = Clipboard.importEntities(PHOTOBOOTH_SETUP_JSON_URL); var success = Clipboard.importEntities(PHOTOBOOTH_SETUP_JSON_URL);
var frontFactor = 10; var frontFactor = 10;
// getForward is preffered as getFront function is deprecated // getForward is preffered as getFront function is deprecated