-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: janusweb action: commit revision: path_from: revision_from: 6c7304978e1194cd085f17bf8a0bf79f189a0296: path_to: revision_to:
commit 6c7304978e1194cd085f17bf8a0bf79f189a0296 Author: James Baicoianu <james_github@baicoianu.com> Date: Thu Oct 19 22:37:37 2017 -0700 Added collision_*, tag, className, classList attributes, plus gaze events, isType() hasClass() addClass() removeClass() updateClassName() setClassName() diff --git a/scripts/janusbase.js b/scripts/janusbase.js
--- a/scripts/janusbase.js +++ b/scripts/janusbase.js @@ -31,6 +31,20 @@ elation.require(['engine.things.generic', 'utils.template'], function() { onclick: { type: 'object' }, anim_id: { type: 'string' }, anim_transition_time: { type: 'float', default: .2 }, + collision_id: { type: 'string', set: this.updateCollider }, + collision_pos: { type: 'vector3', default: new THREE.Vector3(0,0,0), set: this.updateCollider }, + collision_scale: { type: 'vector3', set: this.updateCollider }, + collision_static: { type: 'boolean', default: true, set: this.updateCollider }, + collision_trigger: { type: 'boolean', default: false, set: this.updateCollider }, + collision_radius: { type: 'float', set: this.updateCollider }, + classList: { type: 'object', default: [] }, + className: { type: 'string', default: '', set: this.setClassName }, + tag: { type: 'string', default: '' }, + hasposition: { type: 'boolean', default: true }, + ongazeenter: { type: 'callback' }, + ongazeleave: { type: 'callback' }, + ongazeprogress: { type: 'callback' }, + ongazeactivate: { type: 'callback' }, }); this.eventlistenerproxies = {}; @@ -148,6 +162,17 @@ elation.require(['engine.things.generic', 'utils.template'], function() { sync: ['property', 'sync'], locked: ['property', 'sync'], visible: ['property', 'visible'], + tagName: ['property', 'tag'], + className: ['property', 'className'], + classList: ['property', 'classList'], + + pickable: [ 'property', 'pickable'], + collision_id: [ 'property', 'collision_id'], + collision_pos: [ 'property', 'collision_pos' ], + collision_scale: [ 'property', 'collider_scale'], + collision_static: [ 'property', 'collision_static'], + collision_trigger: [ 'property', 'collision_trigger'], + collision_radius: [ 'property', 'collision_radius'], onupdate: ['callback', 'update'], oncollision: ['callback', 'collision'], @@ -167,6 +192,11 @@ elation.require(['engine.things.generic', 'utils.template'], function() { ondragstart: ['callback', 'dragstart'], ondragend: ['callback', 'dragend'], ondrop: ['callback', 'drop'], + ongazeenter: ['callback', 'gazeenter'], + ongazeleave: ['callback', 'gazeleave'], + ongazemove: ['callback', 'gazemove'], + ongazeactivate: ['callback', 'gazeactivate'], + ongazeprogress: ['callback', 'gazeprogress'], createObject: ['function', 'createObject'], appendChild: ['function', 'appendChild'], @@ -329,6 +359,9 @@ elation.require(['engine.things.generic', 'utils.template'], function() { proxyobj = this.room.jsobjects[obj]; } if (proxyobj) { + if (proxyobj.parent) { + proxyobj.parent.removeChild(proxyobj); + } //var realobj = this.room.getObjectFromProxy(proxyobj); var realobj = proxyobj._target; if (realobj) { @@ -462,5 +495,30 @@ console.error('dunno what this is', other); var realobj = obj.target || obj; return this === realobj; } + this.isType = function(type) { + return this.tag == type.toUpperCase(); + } + this.addClass = function(classname) { + if (!this.hasClass(classname)) { + this.classList.push(classname); + } + this.updateClassName(); + } + this.removeClass = function(classname) { + var idx = this.classList.indexOf(classname); + if (idx != -1) { + this.classList.splice(idx, 1); + } + this.updateClassName(); + } + this.hasClass = function(classname) { + return this.classList.indexOf(classname) != -1; + } + this.updateClassName = function() { + this.className = this.classList.join(' '); + } + this.setClassName = function() { + this.classList = this.className.split(' '); + } }, elation.engine.things.generic); });
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 19:07:16 2024