Bläddra i källkod

Added error handling for failed full screen attempt.

tags/1.0
Matthew Petroff 12 år sedan
förälder
incheckning
d9f858f165
1 ändrade filer med 21 tillägg och 14 borttagningar
  1. +21
    -14
      src/js/pannellum.js

+ 21
- 14
src/js/pannellum.js Visa fil

@@ -126,6 +126,9 @@ function init() {
document.addEventListener('mozfullscreenchange',onFullScreenChange,false);
document.addEventListener('webkitfullscreenchange',onFullScreenChange,false);
document.addEventListener('fullscreenchange',onFullScreenChange,false);
document.addEventListener('mozfullscreenerror',fullScreenError,false);
document.addEventListener('webkitfullscreenerror',fullScreenError,false);
document.addEventListener('fullscreenerror',fullScreenError,false);
window.addEventListener('resize',onDocumentResize,false);
document.addEventListener('keydown',onDocumentKeyPress,false)
@@ -293,20 +296,7 @@ function toggleFullWindow() {
page.webkitRequestFullScreen();
}
} catch(event) {
if(getURLParameter('popout') != 'yes') {
// open new window instead
var windowspecs = 'width=' + screen.width + ',height=' + screen.height + ',left=0,top=0';
var windowlocation = window.location.href + '&popout=yes';
try {
camera.aspect = window.innerWidth / window.innerHeight;
windowlocation += '&popoutautoload=yes';
} catch(event) {
// panorama not loaded
}
window.open(windowlocation,null,windowspecs)
} else {
window.close();
}
fullScreenError();
}
} else {
if (document.exitFullscreen) {
@@ -334,6 +324,23 @@ function onFullScreenChange() {
}
}

function fullScreenError() {
if(getURLParameter('popout') != 'yes') {
// open new window instead
var windowspecs = 'width=' + screen.width + ',height=' + screen.height + ',left=0,top=0';
var windowlocation = window.location.href + '&popout=yes';
try {
camera.aspect = window.innerWidth / window.innerHeight;
windowlocation += '&popoutautoload=yes';
} catch(event) {
// panorama not loaded
}
window.open(windowlocation,null,windowspecs)
} else {
window.close();
}
}

function zoomIn() {
if( fov >= 40 ) {
fov -= 5;


Laddar…
Avbryt
Spara