repo: janusweb
action: commit
revision: 
path_from: 
revision_from: f38026733d00bf0eea09165f800969fc47223885:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit f38026733d00bf0eea09165f800969fc47223885
Author: James Baicoianu 
Date:   Sat Oct 19 02:36:36 2019 -0700

    Websurface image_id thumbnail support

diff --git a/scripts/object.js b/scripts/object.js
index 5ab2bc44720ea4c47a5846181630b3c3b251a270..
index ..0f3a53258118606d82599b89f9dbdb225959bdea 100644
--- a/scripts/object.js
+++ b/scripts/object.js
@@ -389,7 +389,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
           }
         }
       }
-      if (this.websurface_id) {
+      if (this.websurface_id && this.websurface) {
         this.replaceWebsurfaceMaterial();
         return;
       }
@@ -859,10 +859,13 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
         }
       }
       if (this.websurface_id) {
-        if (!this.websurface) {
+        elation.events.add(this, 'click', elation.bind(this, this.handleWebsurfaceClick));
+        if (!this.websurface && !this.image_id) {
           this.createWebsurface();
         }
-        this.websurface.start();
+        if (this.websurface) {
+          this.websurface.start();
+        }
       }
     }
     this.stop = function() {
@@ -895,6 +898,11 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
         }
       }
     }
+    this.handleWebsurfaceClick = function() {
+      if (this.websurface_id && !this.websurface) {
+        this.createWebsurface();
+      }
+    }
     this.handleAutoplayStart = function() {
       if (this.playbutton) {
         this.remove(this.playbutton);

-----END OF PAGE-----