repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 9efe0f9b701ca2cda388ba5dd604498010e27b8c:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 9efe0f9b701ca2cda388ba5dd604498010e27b8c
Author: James Baicoianu 
Date:   Thu Jul 20 15:01:13 2017 -0700

    Improved avatar and cursor handling

diff --git a/scripts/janusplayer.js b/scripts/janusplayer.js
index 734f2ef71f5e1b1b6eb21040c0f469f1ed253c77..
index ..c6b72d7861bd935e607aab652caa3609656f4af9 100644
--- a/scripts/janusplayer.js
+++ b/scripts/janusplayer.js
@@ -2,7 +2,7 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
   elation.requireCSS('janusweb.janusplayer');

   elation.component.add('engine.things.janusplayer', function() {
-    this.defaultavatar = ''
+    this.defaultavatar = '\n  \n    \n  \n  \n    \n  \n'

     this.postinit = function() {
       elation.engine.things.janusplayer.extendclass.postinit.call(this);
@@ -87,6 +87,8 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
       elation.events.add(this.engine.client.container, 'mousedown', elation.bind(this, this.updateMouseStatus));
       elation.events.add(this.engine.client.container, 'mouseup', elation.bind(this, this.updateMouseStatus));

+      elation.events.add(this.room, 'mouseover,mouseout', elation.bind(this, this.updateCursorStyle));
+
       this.updateVRButton();
     }
     this.createChildren = function() {
@@ -408,6 +410,7 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
       return this.getSetting('avatar', this.defaultavatar);
     }
     this.setAvatar = function(avatar) {
+      this.avatarNeedsUpdate = true;
       return this.setSetting('avatar', avatar);
     }
     this.hasVoipData = function() {
@@ -512,5 +515,25 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
       this.setSetting('username', username);
       elation.events.fire({type: 'username_change', element: this, data: username});
     }
+    this.updateCursorStyle = function(ev) {
+      var vrdisplay = this.engine.systems.render.views.main.vrdisplay;
+      var obj = ev.target || ev.element;
+      var proxyobj = (obj.getProxyObject ? obj.getProxyObject() : obj);
+
+      if (ev.type == 'mouseover' && (
+            obj.onclick ||
+            elation.events.hasEventListener(obj, 'click') ||
+            elation.events.hasEventListener(proxyobj, 'click') ||
+            obj.onmousedown ||
+            elation.events.hasEventListener(obj, 'mousedown') ||
+            elation.events.hasEventListener(proxyobj, 'mousedown'))
+          ) {
+        this.cursor_style = 'pointer';
+      } else if (this.engine.systems.controls.pointerLockActive || (vrdisplay && vrdisplay.isPresenting)) {
+        this.cursor_style = 'crosshair';
+      } else {
+        this.cursor_style = 'default';
+      }
+    }
   }, elation.engine.things.player);
 });

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