repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 50f0696151df35ba6f21158218c914c91c0bcc45:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 50f0696151df35ba6f21158218c914c91c0bcc45
Author: James Baicoianu 
Date:   Fri Oct 20 00:13:18 2017 -0700

    Replace special-case onclick handling with more general event handling

diff --git a/scripts/janusbase.js b/scripts/janusbase.js
index a66071e689e9b10c0f8a2e6dfdb9ba97826e99a1..
index ..83bf48a364ae396caa7fdbc4e4083872ca43ba5d 100644
--- a/scripts/janusbase.js
+++ b/scripts/janusbase.js
@@ -51,17 +51,6 @@ elation.require(['engine.things.generic', 'utils.template'], function() {
       //if (this.col) this.color = this.col;
       elation.events.add(this.room, 'janusweb_script_frame_end', elation.bind(this, this.handleFrameUpdates));
       this.colorIsDefault = true;
-
-      if (this.onclick) {
-        if (elation.utils.isString(this.onclick)) {
-          elation.events.add(this, 'click', elation.bind(this, function() { 
-            eval(this.onclick);
-          }));
-          
-        } else {
-          elation.events.add(this, 'click', elation.bind(this, this.onclick));
-        }
-      }
     }
     this.updateColor = function() {
       if (this.properties.color === this.defaultcolor) {
@@ -232,6 +221,21 @@ elation.require(['engine.things.generic', 'utils.template'], function() {
           this.defineProperties(propertydefs);
           this._proxyobject._proxydefs = proxydefs;
         }
+
+        var proxyevents = [
+          'update', 'collision',
+          'mouseover', 'mouseout', 'mousemove', 'mousedown', 'mouseup', 'click',
+          'touchstart', 'touchmove', 'touchend',
+          'dragover', 'drag', 'dragenter', 'dragleave', 'dragstart', 'dragend', 'drop',
+          'gazeenter', 'gazeleave', 'gazemove', 'gazeactivate', 'gazeprogress',
+        ];
+        for (var i = 0; i < proxyevents.length; i++) {
+          var evname = proxyevents[i];
+          if (this['on' + evname]) {
+            //elation.events.add(this, evname, elation.bind(this, this.executeCallback, this['on' + evname]));
+            this._proxyobject['on' + evname] = this['on' + evname];
+          }
+        }
       }
       return this._proxyobject;
     }

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