Browse Source

Added error handling for failed full screen attempt.

tags/1.0
Matthew Petroff 12 years ago
parent
commit
d9f858f165
1 changed files with 21 additions and 14 deletions
  1. +21
    -14
      src/js/pannellum.js

+ 21
- 14
src/js/pannellum.js View File

@@ -126,6 +126,9 @@ function init() {
document.addEventListener('mozfullscreenchange',onFullScreenChange,false); document.addEventListener('mozfullscreenchange',onFullScreenChange,false);
document.addEventListener('webkitfullscreenchange',onFullScreenChange,false); document.addEventListener('webkitfullscreenchange',onFullScreenChange,false);
document.addEventListener('fullscreenchange',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); window.addEventListener('resize',onDocumentResize,false);
document.addEventListener('keydown',onDocumentKeyPress,false) document.addEventListener('keydown',onDocumentKeyPress,false)
@@ -293,20 +296,7 @@ function toggleFullWindow() {
page.webkitRequestFullScreen(); page.webkitRequestFullScreen();
} }
} catch(event) { } 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 { } else {
if (document.exitFullscreen) { 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() { function zoomIn() {
if( fov >= 40 ) { if( fov >= 40 ) {
fov -= 5; fov -= 5;


Loading…
Cancel
Save