-- 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: 3a46f6f2aa392d420619397113fbdb99e587ee77: path_to: revision_to:
commit 3a46f6f2aa392d420619397113fbdb99e587ee77 Author: James Baicoianu <james_github@baicoianu.com> Date: Mon Sep 24 23:19:31 2018 -0700 Added onloadstart / onloadprogress / onload events diff --git a/scripts/image.js b/scripts/image.js
--- a/scripts/image.js +++ b/scripts/image.js @@ -7,6 +7,9 @@ elation.require(['janusweb.janusbase'], function() { sbs3d: { type: 'boolean', default: false, set: this.setMaterialDirty }, ou3d: { type: 'boolean', default: false, set: this.setMaterialDirty }, reverse3d: { type: 'boolean', default: false, set: this.setMaterialDirty }, + onloadstart: { type: 'callback' }, + onloadprogress: { type: 'callback' }, + onload: { type: 'callback' }, }); } this.createObject3D = function() { @@ -58,6 +61,8 @@ elation.require(['janusweb.janusbase'], function() { if (this.asset) { this.texture = this.asset.getInstance(); if (this.texture) { + this.dispatchEvent({type: 'loadstart'}); + elation.events.add(this.asset, 'asset_load_progress', (ev) => { this.dispatchEvent({type: 'loadprogress', data: ev.data}); }); elation.events.add(this.texture, 'asset_load', elation.bind(this, this.imageloaded)); elation.events.add(this.texture, 'update', elation.bind(this, this.refresh)); @@ -159,6 +164,7 @@ elation.require(['janusweb.janusbase'], function() { //this.objects['3d'].onBeforeRender = () => { texture.swap(); } } + this.dispatchEvent({type: 'load'}); this.refresh(); } this.getProxyObject = function(classdef) { diff --git a/scripts/object.js b/scripts/object.js
--- a/scripts/object.js +++ b/scripts/object.js @@ -22,6 +22,9 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() { blend_src: { type: 'string', default: 'src_alpha', set: this.updateMaterial }, blend_dest: { type: 'string', default: 'one_minus_src_alpha', set: this.updateMaterial }, envmap_id: { type: 'string', set: this.updateMaterial }, + onloadstart: { type: 'callback' }, + onloadprogress: { type: 'callback' }, + onload: { type: 'callback' }, }); //elation.events.add(this, 'thing_init3d', elation.bind(this, this.assignTextures)); @@ -37,11 +40,14 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() { var object = null, geometry = null, material = null; if (this.janusid) { var asset = this.getAsset('model', this.janusid, true); + this.dispatchEvent({type: 'loadstart'}); if (asset) { if (asset.loaded) { setTimeout(elation.bind(this, this.handleLoad), 0); } else { elation.events.add(asset, 'asset_load_complete', elation.bind(this, this.handleLoad)); + + elation.events.add(asset, 'asset_load_progress', (ev) => { this.dispatchEvent({type: 'loadprogress', data: ev.data}); }); } object = asset.getInstance(); } @@ -93,7 +99,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() { if (!this.assetloaded) { this.setTextureDirty(); setTimeout(elation.bind(this, function() { - elation.events.fire({type: 'load', element: this}); + this.dispatchEvent({type: 'load'}); }), 0); this.jsparts.updateParts(); this.assetloaded = true;
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 14:47:53 2024