Skip to content

Commit

Permalink
Added 'loaded' events to panorama and image objects
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchirls committed Oct 20, 2015
1 parent 8861f16 commit b11524e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build/vr.dev.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/objects/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module.exports = (function () {
material,
mesh,
src,
tex;
tex,
self = this;

if (typeof options === 'string') {
src = options;
Expand All @@ -25,6 +26,8 @@ module.exports = (function () {
material.visible = true;
mesh.visible = true;
parent.add(mesh);

self.emit('loaded');
});
}

Expand Down
7 changes: 5 additions & 2 deletions src/objects/panorama.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ module.exports = (function () {
var material,
mesh,
src,
tex;
tex,
self = this;

if (typeof options === 'string') {
src = options;
Expand All @@ -21,7 +22,9 @@ module.exports = (function () {
}

if (src) {
tex = materials.imageTexture(src, THREE.UVMapping);
tex = materials.imageTexture(src, THREE.UVMapping, function () {
self.emit('loaded');
});
}

material = new THREE.MeshBasicMaterial({
Expand Down

0 comments on commit b11524e

Please sign in to comment.