Przeglądaj źródła

Improved error handling.

tags/1.0
Matthew Petroff 12 lat temu
rodzic
commit
d7add76b37
2 zmienionych plików z 18 dodań i 16 usunięć
  1. +17
    -15
      src/js/pannellum.js
  2. +1
    -1
      src/pannellum.htm

+ 17
- 15
src/js/pannellum.js Wyświetl plik

@@ -90,28 +90,30 @@ function init()
panotexture.needsUpdate = true;
mesh = new THREE.Mesh(new THREE.Sphere(500,60,40), new THREE.MeshBasicMaterial({map:panotexture}));
mesh.scale.x = -1;
//try
//{
try
{
scene.addObject(mesh);
//}
//catch (event)
//{
// // show error message if canvas is not supported
// document.getElementById('nocanvas').style.display = 'table';
//}
}
catch (event)
{
// show error message if canvas is not supported
load_box.style.display = 'none';
document.getElementById('nocanvas').style.display = 'table';
}
// try to use WebGL, else fallback to 2D canvas
//try
//{
try
{
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth,window.innerHeight);
renderer.initWebGLObjects(scene);
//}
/*catch (event)
}
catch (event)
{
renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth,window.innerHeight);
}*/
// show error message if WebGl is not supported
load_box.style.display = 'none';
document.getElementById('nocanvas').style.display = 'table';
}
container.appendChild(renderer.domElement);


+ 1
- 1
src/pannellum.htm Wyświetl plik

@@ -33,7 +33,7 @@
<div id="load_button" onclick="load()" class="noselect"><p>Load<br>Panorama<p></div>
<div id="nocanvas" class="noselect"><p>A browser supporting the canvas element (and WebGL) is required to view this panorama.</p></div>
<div id="nocanvas" class="noselect"><p>A browser supporting WebGL (and the canvas element) is required to view this panorama.</p></div>
<div id="about_box" class="noselect"><div id="close_button" class="sprite" onclick="about_box.style.display='none'"></div><div id="pannellum_logo_about" class="sprite"></div><a href="http://pannellum.sf.net/" target="_blank">http://pannellum.sf.net/</a><p>Licensing:<br><a href="//www.gnu.org/licenses/lgpl-2.1.txt" target="_blank">GNU LGPL v2.1</a></div>


Ładowanie…
Anuluj
Zapisz