spherical-viewer
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "spherical-viewer", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "panorama photo viewer", | ||
@@ -5,0 +5,0 @@ "author": "Kazuhiko Arase", |
@@ -553,2 +553,50 @@ // | ||
var fakeFullscreen = function() { | ||
var orgSize = null; | ||
var fullscreened = false; | ||
return function() { | ||
fullscreened = !fullscreened; | ||
if (!fullscreened) { | ||
return; | ||
} | ||
orgSize = { width : cv.width, height : cv.height }; | ||
document.body.style.overflow = 'hidden'; | ||
cv.style.position = 'absolute'; | ||
cv.style.left = '0px'; | ||
cv.style.top = '0px'; | ||
var lastSize = { width : 0, height : 0 }; | ||
var watchWindow = function() { | ||
if (!fullscreened) { | ||
// exit fullscreen. | ||
document.body.style.overflow = ''; | ||
cv.style.position = ''; | ||
cv.style.left = ''; | ||
cv.style.top = ''; | ||
cv.width = orgSize.width; | ||
cv.height = orgSize.height; | ||
return; | ||
} | ||
var size = { width : window.innerWidth, height : window.innerHeight }; | ||
var resized = lastSize.width != size.width || | ||
lastSize.height != size.height; | ||
if (resized) { | ||
cv.width = size.width; | ||
cv.height = size.height; | ||
lastSize = size; | ||
} | ||
window.setTimeout(watchWindow, 50); | ||
}; | ||
watchWindow(); | ||
}; | ||
}; | ||
var fullscreenSupport = function() { | ||
@@ -558,3 +606,3 @@ | ||
if (!names || !document[names.fullscreenEnabled]) { | ||
return function() {}; | ||
return fakeFullscreen(); | ||
} | ||
@@ -561,0 +609,0 @@ |
22124
656