Permalink
Browse files

Added toggleFullscreen method

Updated HTML page with new shortcuts and github information
  • Loading branch information...
1 parent 5ff4a55 commit 8b9d971e60236a5245db3e2988bdeba1f79e7a67 @fieldOfView committed Feb 5, 2011
Showing with 62 additions and 7 deletions.
  1. +7 −6 index.html
  2. +55 −1 js/ptviewerng.js
View
@@ -38,8 +38,8 @@
<h1>PTViewerNG</h1>
<p><b> Prof. Dr. H. Dersch - HFU Furtwangen </b>
<br>
-January 29, 2010<br>
-Updated Januari 10, 2011 by Aldo Hoeben
+Github repository maintained by <b>Aldo Hoeben / <a href="http://fieldofview.com">fieldOfView</a></b>:<br>
+<a href="https://github.com/fieldOfView/PTViewerNG">https://github.com/fieldOfView/PTViewerNG</a>
</p>
<hr>
@@ -48,7 +48,7 @@ <h2>PTViewerNG - Plugin-Free Open-GL Panorama Viewer</h2>
PTViewerNG is based on <a href="http://khronos.org/webgl/wiki/Main_Page">WebGL</a>. It was created by
<a href="http://webuser.hs-furtwangen.de/~dersch/PTViewerNG/PTViewerNG.html">Helmut
Dersch</a>.
-To view the demo download and install one of the compatible browsers. The viewer has been tested with the current batch of WebGL enabled browsers, including Chrome 8 and Firefox 4b8.</p>
+To view the demo download and install one of the compatible browsers. The viewer has been tested with the current batch of WebGL enabled browsers, including Chrome 8 and Firefox 4b8 and newer.</p>
<p>Panorama by <a href="http://dmmdh.nl">Wim Koorneef</a></p>
<p>
Copyright 2010&nbsp; Helmut Dersch
@@ -68,10 +68,11 @@ <h2>PTViewerNG - Plugin-Free Open-GL Panorama Viewer</h2>
<br>
<b>Accelerate left-right-up-down using arrow keys, or Numpad 4,6,8,2.
<br>
-Zoom in and out using +/- keys.
+Zoom in and out using +/-, Shift/Control or A/Z keys.
<br>
-Stop using 'c' or space or Numpad 5.
-
+Stop using C or space or Numpad 5.
+<br>
+Toggle full window mode using F.
</td>
</tr>
</table>
View
@@ -379,14 +379,23 @@ function PTViewerNG( pt_canvas, panorama ) {
}
- var fov = 45;
+ var fov = 70;
var xRot = 0;
var yRot = 0;
var zRot = 0;
function drawScene() {
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
+ if(isFullscreen) {
+ if(canvas.width != document.body.clientWidth || canvas.height != document.body.clientHeight) {
+ canvas.width = document.body.clientWidth;
+ canvas.height = document.body.clientHeight;
+ }
+ }
+
var aspect = canvas.width / canvas.height;
+ gl.viewport(0, 0, canvas.width, canvas.height);
+
perspective(fov, aspect, 0.1, 100.0);
loadIdentity();
@@ -481,6 +490,7 @@ function PTViewerNG( pt_canvas, panorama ) {
var zoomInKeys = [ 16, 65, 107, 61, 187 ];
var zoomOutKeys = [ 17, 90, 109, 189 ];
var stopKeys = [ 67,32,101 ];
+ var fullscreenKeys = [ 70 ];
function pressedOneOf( keylist ){
for(var i=0; i< keylist.length; i++)
@@ -489,6 +499,8 @@ function PTViewerNG( pt_canvas, panorama ) {
return false;
}
+ var fullscreenKeyDown;
+
function handleKeys() {
if( pressedOneOf( panLeftKeys ) )
panLeft();
@@ -504,6 +516,14 @@ function PTViewerNG( pt_canvas, panorama ) {
zoomOut();
if( pressedOneOf( stopKeys ) )
stop();
+
+ if( pressedOneOf( fullscreenKeys ) ) {
+ if(!fullscreenKeyDown) {
+ fullscreenKeyDown = true;
+ toggleFullscreen();
+ }
+ } else
+ fullscreenKeyDown = false;
}
@@ -590,4 +610,38 @@ function PTViewerNG( pt_canvas, panorama ) {
return false;
}
+
+ this.toggleFullscreen = toggleFullscreen;
+ var isFullscreen = false;
+ var canvasStylesStore = Object();
+
+ function toggleFullscreen() {
+ if(!isFullscreen) {
+ canvasStylesStore = Object( {
+ position: ( canvas.style.position != "" ) ? canvas.style.position : "static",
+ top: ( canvas.style.top != "" ) ? canvas.style.top : "0px",
+ left: ( canvas.style.left != "" ) ? canvas.style.left : "0px",
+ width: ( canvas.style.width != "" ) ? canvas.style.width : "auto",
+ height: ( canvas.style.height != "" ) ? canvas.style.height : "auto",
+ canvaswidth: canvas.width,
+ canvasheight: canvas.height,
+ } );
+
+ canvas.style.position = "fixed";
+ canvas.style.top = "0px";
+ canvas.style.left = "0px";
+ canvas.style.width = "100%";
+ canvas.style.height = "100%";
+ } else {
+ canvas.style.position = canvasStylesStore.position;
+ canvas.style.top = canvasStylesStore.top;
+ canvas.style.left = canvasStylesStore.left;
+ canvas.style.width = canvasStylesStore.width;
+ canvas.style.height = canvasStylesStore.height;
+ canvas.width = canvasStylesStore.canvaswidth;
+ canvas.height = canvasStylesStore.canvasheight;
+
+ }
+ isFullscreen = !isFullscreen;
+ }
}

0 comments on commit 8b9d971

Please sign in to comment.