From 2c77580ee9d62bdf83692c99d68fec1bb42eec37 Mon Sep 17 00:00:00 2001 From: Faye Li Date: Wed, 15 Feb 2017 15:58:11 -0800 Subject: [PATCH] use the new tablet event bridge --- .../render/photobooth/html/photobooth.html | 168 +++++------------- .../{photobooth.js => photoboothApp.js} | 22 ++- 2 files changed, 55 insertions(+), 135 deletions(-) rename scripts/developer/utilities/render/photobooth/{photobooth.js => photoboothApp.js} (95%) diff --git a/scripts/developer/utilities/render/photobooth/html/photobooth.html b/scripts/developer/utilities/render/photobooth/html/photobooth.html index a7740330fb..0250084a54 100644 --- a/scripts/developer/utilities/render/photobooth/html/photobooth.html +++ b/scripts/developer/utilities/render/photobooth/html/photobooth.html @@ -10,7 +10,6 @@ padding: 0; width: 100%; color: white; - background: linear-gradient(#2b2b2b, #0f212e); } .top-bar { @@ -32,22 +31,44 @@ margin-top: 90px; padding: 30px; } - - - + + + +
+
Photobooth
+
+
+
+
+ + + +
+ +
+ +
+
+
+ - - - - -
-
Photobooth
-
-
-
-
- - - -
- -
- -
-
-
diff --git a/scripts/developer/utilities/render/photobooth/photobooth.js b/scripts/developer/utilities/render/photobooth/photoboothApp.js similarity index 95% rename from scripts/developer/utilities/render/photobooth/photobooth.js rename to scripts/developer/utilities/render/photobooth/photoboothApp.js index ab881ede4d..ca298d00de 100644 --- a/scripts/developer/utilities/render/photobooth/photobooth.js +++ b/scripts/developer/utilities/render/photobooth/photoboothApp.js @@ -19,11 +19,24 @@ icon: "icons/tablet-icons/snap-i.svg", text: "PHOTOBOOTH" }); + function onClicked() { tablet.gotoWebScreen(PHOTOBOOTH_WINDOW_HTML_URL); PhotoBooth.init(); } button.clicked.connect(onClicked); + tablet.webEventReceived.connect(onWebEventReceived); + + function onWebEventReceived(event) { + print("photobooth.js received a web event:" + event); + // Converts the event to a JavasScript Object + if (typeof event === "string") { + event = JSON.parse(event); + } + if (event.app === "photobooth") { + + } + } var PhotoBooth = {}; PhotoBooth.init = function () { @@ -170,20 +183,13 @@ print("clicked reload model button " + event.value); PhotoBooth.changeModel(event.value); }; - - photoboothWindow.webEventReceived.connect(function (data) { - var event = JSON.parse(data); - if (photoboothWindowListener[event.type]) { - photoboothWindowListener[event.type](event); - } - }); }; main(); function cleanup() { + tablet.removeButton(button); Camera.mode = "first person"; PhotoBooth.destroy(); - tablet.removeButton(button); } Script.scriptEnding.connect(cleanup); }()); \ No newline at end of file