changeset 2778:80c95ab21220

#138 Create the image controller in core.js
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Fri, 21 Apr 2017 14:56:28 +0100
parents 72604c3a3ed9
children 46105b2573fc
files js/core.js
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Fri Apr 21 14:46:16 2017 +0100
+++ b/js/core.js	Fri Apr 21 14:56:28 2017 +0100
@@ -1113,9 +1113,9 @@
         }
         var node = this.popupOptions[this.currentIndex],
             pass = true,
-            timeDelta = (new Date() - lastNodeStart)/1000.0;
+            timeDelta = (new Date() - lastNodeStart) / 1000.0;
         if (timeDelta < node.specification.minWait) {
-            interfaceContext.lightbox.post("Error", "Not enough time has elapsed, please wait "+(node.specification.minWait-timeDelta).toFixed(0)+" seconds");
+            interfaceContext.lightbox.post("Error", "Not enough time has elapsed, please wait " + (node.specification.minWait - timeDelta).toFixed(0) + " seconds");
             return;
         }
         node.elapsedTime = timeDelta;
@@ -3009,6 +3009,22 @@
         return volume;
     })();
 
+    this.imageHolder = (function () {
+        var imageController = {};
+        imageController.root = document.createElement("div");
+        imageController.root.id = "imageController";
+        imageController.img = document.createElement("img");
+        imageController.root.appendChild(imageController.img);
+        imageController.setImage = function (src) {
+            imageController.img.src = "";
+            if (typeof src !== "string" || src.length == undefined) {
+                return;
+            }
+            imageController.img.src = src;
+        }
+        return imageController;
+    })();
+
     this.calibrationModuleObject = null;
     this.calibrationModule = function () {
         // This creates an on-page calibration module