repo: janusweb action: commit revision: path_from: revision_from: 4fa7926bb8995cf41f80b9101e309332a78a2bf6: path_to: revision_to:
commit 4fa7926bb8995cf41f80b9101e309332a78a2bf6 Author: James BaicoianuDate: Mon May 27 13:26:34 2024 -0700 Added preload option to portals diff --git a/scripts/portal.js b/scripts/portal.js
--- a/scripts/portal.js
+++ b/scripts/portal.js
@@ -21,6 +21,7 @@ elation.require(['janusweb.janusbase'], function() {
'mirror_recursion': { type: 'integer', default: 2, set: this.updateGeometry },
'mirror_texturesize': { type: 'integer', default: 1024, set: this.updateGeometry },
'external': { type: 'boolean', default: false },
+ 'preload': { type: 'boolean', default: false },
'target': { type: 'string', default: '' },
'round': { type: 'boolean', default: false },
'cooldown': { type: 'float', default: 1000 },
@@ -289,7 +290,12 @@ elation.require(['janusweb.janusbase'], function() {
this.closePortal();
}
} else if (this.url) {
- this.properties.janus.setActiveRoom(this.url, room.url);
+ if (this.preload) {
+ let newroom = this.properties.janus.preload(this.url);
+ elation.events.add(newroom, 'room_load_complete', ev => this.properties.janus.setActiveRoom(newroom));
+ } else {
+ this.properties.janus.setActiveRoom(this.url, room.url);
+ }
}
}
var gamepads = this.engine.systems.controls.gamepads;
@@ -320,6 +326,7 @@ elation.require(['janusweb.janusbase'], function() {
shader_id: ['property', 'shader_id'],
size: ['property', 'size'],
round: ['property', 'round'],
+ preload: ['property', 'preload'],
};
}
return this._proxyobject;
-----END OF PAGE-----