-- 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: fd84966893898a63f91df3fe4f2126148a8f17cb: path_to: revision_to:
commit fd84966893898a63f91df3fe4f2126148a8f17cb Author: James Baicoianu <james_github@baicoianu.com> Date: Sun Jan 28 20:23:19 2018 -0800 Teleporter and raycaster fixesy diff --git a/scripts/elements/raycaster.js b/scripts/elements/raycaster.js
--- a/scripts/elements/raycaster.js +++ b/scripts/elements/raycaster.js @@ -1,24 +1,27 @@ -elation.component.add('janusweb.elements.raycaster', { - createChildren() { - this.lasthitobject = null; - }, - update() { - var hits = this.raycast(null, null, this.class); - if (hits.length > 0) { - var hit = hits[0], - hitobject = hit.object; - - if (hitobject != this.lasthitobject) { - if (this.lasthitobject) { - this.dispatchEvent({type: 'raycastleave', data: {object: this.lasthitobject, intersection: hit}}); +elation.require(['janusweb.janusbase'], function() { + elation.component.add('janusweb.elements.raycaster', { + createChildren() { + this.lasthitobject = null; + }, + update() { + var hits = this.raycast(null, null, this.class); + if (hits.length > 0) { + var hit = hits[0], + hitobject = hit.object; + + if (hitobject != this.lasthitobject) { + if (this.lasthitobject) { + this.dispatchEvent({type: 'raycastleave', data: {object: this.lasthitobject, intersection: hit}}); + } + this.dispatchEvent({type: 'raycastenter', data: {object: hit.object, intersection: hit}}); + this.lasthitobject = hitobject; } - this.dispatchEvent({type: 'raycastenter', data: {object: hit.object, intersection: hit}}); - this.lasthitobject = hitobject; + this.dispatchEvent({type: 'raycastmove', data: {object: hit.object, intersection: hit}}); + } else if (this.lasthitobject) { + this.dispatchEvent({type: 'raycastleave', data: {object: this.lasthitobject, intersection: null}}); + this.dispatchEvent({type: 'raycastenter', data: {object: this.lasthitobject.room, intersection: null}}); + this.lasthitobject = this.lasthitobject.room; } - } else if (this.lasthitobject) { - this.dispatchEvent({type: 'raycastleave', data: {object: this.lasthitobject, intersection: null}}); - this.dispatchEvent({type: 'raycastenter', data: {object: this.lasthitobject.room, intersection: null}}); - this.lasthitobject = this.lasthitobject.room; } - } -}, elation.janusweb.janusbase); + }, elation.janusweb.janusbase); +}); diff --git a/scripts/elements/teleporter.js b/scripts/elements/teleporter.js
--- a/scripts/elements/teleporter.js +++ b/scripts/elements/teleporter.js @@ -1,13 +1,14 @@ -elation.component.add('janusweb.elements.teleporter', { +elation.require(['janusweb.janusbase'], function() { + elation.component.add('janusweb.elements.teleporter', { active: false, longpresstime: 250, deadzone: 5, createChildren() { this.marker = this.createObject('Object', { - id: 'pipe', - col: '#009', - scale: V(.5,.05,.5) + id: 'cylinder', + col: V(0,0,155,.5), + scale: V(.5,1.6,.5) }); this.light = this.createObject('Light', { col: '#009', @@ -39,7 +40,7 @@ elation.component.add('janusweb.elements.teleporter', { this.setRoom(this.room); this.disableCursor(); window.addEventListener('mousemove', this.handleMouseMove); - window.addEventListener('touchmove', this.handleTouchMove); + window.addEventListener('touchmove', this.handleTouchMove, true); }, setRoom(room) { if (!room.addEventListener) room = room.getProxyObject(); @@ -81,9 +82,13 @@ elation.component.add('janusweb.elements.teleporter', { if (distance > this.deadzone) { clearTimeout(this.longpresstimer); } + if (this.active) { + ev.stopPropagation(); + ev.preventDefault(); + } } }, - handleMouseUp() { + handleMouseUp(ev) { if (this.longpresstimer) { clearTimeout(this.longpresstimer); } @@ -98,10 +103,12 @@ elation.component.add('janusweb.elements.teleporter', { this.pos = player.cursor_pos; this.visible = true; this.active = true; + this.particles.start(); }, disableCursor() { this.visible = false; this.active = false; + this.particles.stop(); }, update() { if (this.active) { @@ -109,3 +116,4 @@ elation.component.add('janusweb.elements.teleporter', { } } }); +});
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 18:04:21 2024