diff --git a/CHANGELOG.md b/CHANGELOG.md index 09c4204..ab659b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/js/isvr-photosphere-menu-thumb-component.js b/js/isvr-photosphere-menu-thumb-component.js index b53837d..8028a8a 100644 --- a/js/isvr-photosphere-menu-thumb-component.js +++ b/js/isvr-photosphere-menu-thumb-component.js @@ -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 */ diff --git a/js/isvr-scene.js b/js/isvr-scene.js index e8b727e..01857d6 100644 --- a/js/isvr-scene.js +++ b/js/isvr-scene.js @@ -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() {