repo: janusweb action: commit revision: path_from: revision_from: 9efe0f9b701ca2cda388ba5dd604498010e27b8c: path_to: revision_to:
commit 9efe0f9b701ca2cda388ba5dd604498010e27b8c Author: James BaicoianuDate: Thu Jul 20 15:01:13 2017 -0700 Improved avatar and cursor handling diff --git a/scripts/janusplayer.js b/scripts/janusplayer.js
--- 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-----