瀏覽代碼

Added error handling for failed full screen attempt.

tags/1.0
Matthew Petroff 12 年之前
父節點
當前提交
d9f858f165
共有 1 個文件被更改,包括 21 次插入14 次删除
  1. +21
    -14
      src/js/pannellum.js

+ 21
- 14
src/js/pannellum.js 查看文件

@@ -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;


Loading…
取消
儲存