Skip to content

Commit

Permalink
fixes issues
Browse files Browse the repository at this point in the history
  • Loading branch information
weddingdj committed Oct 14, 2017
1 parent a8c9969 commit 21a33d7
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 46 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.5

- user height and positional controllers height fix
- photo sphere menu bug fix: clicking on thumbnail of current photo sphere made scene black

## 1.4

- Controller responsiveness improved on navigation and info hotspots
Expand Down
86 changes: 46 additions & 40 deletions js/isvr-photosphere-menu-thumb-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,47 +23,53 @@ AFRAME.registerComponent('isvr-photosphere-menu-thumb', {
hotspots[i].setAttribute('visible', false);
}

/* reset camera rotation in order to let people see the photo sphere title, if set */
var camera = document.querySelector('#camera');
camera.setAttribute('rotation', { x:0, y:0, z:0 });

var sphere = document.querySelector('#photosphere');
sphere.emit('photosphere-fade-out');
sphere.setAttribute('material', 'src', '#img-photosphere-' + image_id);
sphere.setAttribute('data-content-id', content_id);

var materialtextureloaded_listener = function() {

document.querySelector('#photosphere-menu').setAttribute('visible', false);

self.el.sceneEl.systems['isvr-scene-helper'].hideCursor();

/* set visible to true on hotspot wrapper, opacity is still 0 so they are invisible */
var hotspot_wrapper = document.querySelectorAll('.hotspot-wrapper-content-id-' + content_id);
for (var i = 0; i < hotspot_wrapper.length; i++) {
hotspot_wrapper[i].setAttribute('visible', true);
}
/* animation */
var hotspots = document.querySelectorAll('.hotspot-content-id-' + content_id);
for (var i = 0; i < hotspots.length; i++) {
hotspots[i].setAttribute('visible', true);
hotspots[i].emit('hotspot-intro-' + content_id);
}

var title = document.querySelector('#photosphere-title-content-id-' + content_id);
if (title != null) {
title.setAttribute('position', { x: 0, y:1.6, z:-2 });
title.setAttribute('visible', true);
setTimeout(function() {
title.setAttribute('visible', false);
/* workaround because of interference with menu */
title.setAttribute('position', { x: 0, y:1.6, z:-10 });
}, 10000);
}
sphere.emit('photosphere-fade-in');
sphere.removeEventListener('materialtextureloaded', materialtextureloaded_listener);
};
sphere.addEventListener('materialtextureloaded', materialtextureloaded_listener);

/* do not allow selecting the current photo sphere again */
if (sphere.getAttribute('material').src.id != 'img-photosphere-' + image_id) {

sphere.emit('photosphere-fade-out');
sphere.setAttribute('material', 'src', '#img-photosphere-' + image_id);
sphere.setAttribute('data-content-id', content_id);

var materialtextureloaded_listener = function() {

/* reset camera rotation in order to let people see the photo sphere title, if set */
var camera = document.querySelector('#camera');
camera.setAttribute('rotation', { x:0, y:0, z:0 });

document.querySelector('#photosphere-menu').setAttribute('visible', false);

self.el.sceneEl.systems['isvr-scene-helper'].hideCursor();

/* set visible to true on hotspot wrapper, opacity is still 0 so they are invisible */
var hotspot_wrapper = document.querySelectorAll('.hotspot-wrapper-content-id-' + content_id);
for (var i = 0; i < hotspot_wrapper.length; i++) {
hotspot_wrapper[i].setAttribute('visible', true);
}
/* animation */
var hotspots = document.querySelectorAll('.hotspot-content-id-' + content_id);
for (var i = 0; i < hotspots.length; i++) {
hotspots[i].setAttribute('visible', true);
hotspots[i].emit('hotspot-intro-' + content_id);
}

var title = document.querySelector('#photosphere-title-content-id-' + content_id);
if (title != null) {
title.setAttribute('position', { x: 0, y:1.6, z:-2 });
title.setAttribute('visible', true);
setTimeout(function() {
title.setAttribute('visible', false);
/* workaround because of interference with menu */
title.setAttribute('position', { x: 0, y:1.6, z:-10 });
}, 10000);
}
sphere.emit('photosphere-fade-in');
sphere.removeEventListener('materialtextureloaded', materialtextureloaded_listener);
};
sphere.addEventListener('materialtextureloaded', materialtextureloaded_listener);

} /* if */

} /* if */

Expand Down
15 changes: 9 additions & 6 deletions js/isvr-scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ AFRAME.registerComponent('isvr-scene', {

this.el.addEventListener('enter-vr', function() {

document.querySelector('#camera').setAttribute('camera', {
far: 10000,
fov: 80,
near: 0.1,
userHeight: 0 /* workaround needed for a-frame 0.7.0 */
});
/* workaround for non-positional tracking devices and a-frame 0.7.0 */
if (!AFRAME.utils.device.checkHasPositionalTracking()) {
document.querySelector('#camera').setAttribute('camera', {
far: 10000,
fov: 80,
near: 0.1,
userHeight: 0
});
}
});

this.el.addEventListener('exit-vr', function() {
Expand Down

0 comments on commit 21a33d7

Please sign in to comment.