From 0f37b4a886e6d554d28a2dd6c5e56badc4d0508a Mon Sep 17 00:00:00 2001 From: ericball Date: Wed, 26 Feb 2014 13:54:16 -0500 Subject: [PATCH 1/3] Update sphere.js I ran into a problem trying to use sphere.js to display a pano with GPano tags created by exiftool. I found the problem was a conflict between the getAttr function (which expects GPano:FullPanoWidthPixels="3000") and the tags created by exiftool (which are the format 3000. --- lib/sphere.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/sphere.js b/lib/sphere.js index 742b0a9..dd49eff 100644 --- a/lib/sphere.js +++ b/lib/sphere.js @@ -338,9 +338,11 @@ Photosphere.prototype.loadEXIF = function(callback){ xmpEnd = ""; xmpp = data.substring(data.indexOf("3000 getAttr = function(attr){ - x = xmpp.indexOf(attr+'="') + attr.length + 2; - return xmpp.substring( x, xmpp.indexOf('"', x) ); + x = xmpp.indexOf(attr) + attr.length; + s = xmpp.substring( x ); + return s.match(/[0-9]+/); }; self.exif = { From e868d0aef3096fac04238be157c05a0dc4410e9a Mon Sep 17 00:00:00 2001 From: Eric ball Date: Mon, 3 Mar 2014 13:08:21 -0500 Subject: [PATCH 2/3] Update sphere.js Added optional vertical field of view parameter (default 75) to function Photosphere. --- lib/sphere.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/sphere.js b/lib/sphere.js index dd49eff..5c047f1 100644 --- a/lib/sphere.js +++ b/lib/sphere.js @@ -6,9 +6,10 @@ // Usage: new Photosphere("image.jpg").loadPhotosphere(document.getElementById("myPhotosphereID")); // myPhotosphereID must have width/height specified! - -function Photosphere(image){ +// 2014-03-03 ericball - added optional vertical field of view parameter +function Photosphere(image, vFoV){ this.image = image; + this.vFov = (typeof vFoV === "undefined") ? 75 : vFoV; //this.worker = new Worker("worker.js"); } @@ -108,7 +109,8 @@ Photosphere.prototype.start3D = function(image){ this.lat = 0; this.lon = 90; this.onMouseDownMouseX = 0, this.onMouseDownMouseY = 0, this.isUserInteracting = false, this.onMouseDownLon = 0, this.onMouseDownLat = 0; - this.camera = new THREE.PerspectiveCamera( 75, parseInt(this.holder.offsetWidth) / parseInt(this.holder.offsetHeight), 1, 1100 ); +// 2014-03-03 ericball - added optional vertical field of view parameter + this.camera = new THREE.PerspectiveCamera( this.vFoV, parseInt(this.holder.offsetWidth) / parseInt(this.holder.offsetHeight), 1, 1100 ); this.scene = new THREE.Scene(); mesh = new THREE.Mesh( new THREE.SphereGeometry( 200, 20, 40 ), this.loadTexture( image ) ); mesh.scale.x = - 1; From 4ddfdc9d13941d791482c81ef61e972fd9e032d7 Mon Sep 17 00:00:00 2001 From: Eric ball Date: Tue, 4 Mar 2014 14:21:35 -0500 Subject: [PATCH 3/3] Update sphere.js Corrected getAttr to return value instead of array. Changed direction of auto-rotation. --- lib/sphere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sphere.js b/lib/sphere.js index 5c047f1..c3846d1 100644 --- a/lib/sphere.js +++ b/lib/sphere.js @@ -149,7 +149,7 @@ Photosphere.prototype.start3D = function(image){ Photosphere.prototype.startMoving = function(){ self = this; this.interval = setInterval(function(){ - self.lon = self.lon - 0.1; + self.lon = self.lon + 0.1; if( -3 < self.lat && self.lat < 3){} else if(self.lat > 10){ self.lat -= 0.1 } @@ -344,7 +344,7 @@ Photosphere.prototype.loadEXIF = function(callback){ getAttr = function(attr){ x = xmpp.indexOf(attr) + attr.length; s = xmpp.substring( x ); - return s.match(/[0-9]+/); + return s.match(/[0-9]+/)[0]; }; self.exif = {